Add a generator to redfam yielding article pages

To work on articles of a redfam a generator which yields belonging
articles is necessary

Related Task: [https://fs.golderweb.de/index.php?do=details&task_id=87 FS#87]
This commit is contained in:
2016-08-28 13:20:13 +02:00
parent 8ce6f03641
commit e5989305a4

View File

@@ -57,6 +57,9 @@ class RedFam:
@param heading str Original heading of RedFam (Link)
"""
# Having pywikibot.Site() is a good idea most of the time
self.site = pywikibot.Site()
# Database interface
self._mysql = MysqlRedFam( fam_hash )
@@ -455,6 +458,15 @@ class RedFamWorker( RedFam ):
# with wrong month abreviations in strptime
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
def article_generator(self):
"""
Yields pywikibot pageobjects for articles belonging to this redfams
in a generator
self.
"""
for article in self._articlesList:
yield pywikibot.Page(pywikibot.Link(article), self.site)
def update_status( self ):
"""
Sets status to 3 when worked on