Update redfam.article_generator use article status
To be able to filter articles by status of that article Related Task: [https://fs.golderweb.de/index.php?do=details&task_id=89 FS#89]
This commit is contained in:
@@ -633,7 +633,9 @@ class RedFamWorker( RedFam ):
|
||||
# with wrong month abreviations in strptime
|
||||
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
|
||||
|
||||
def article_generator(self, filter_existing=None, filter_redirects=None ):
|
||||
def article_generator(self, filter_existing=None, filter_redirects=None,
|
||||
exclude_article_status=[],
|
||||
onlyinclude_article_status=[] ):
|
||||
"""
|
||||
Yields pywikibot pageobjects for articles belonging to this redfams
|
||||
in a generator
|
||||
@@ -647,11 +649,22 @@ class RedFamWorker( RedFam ):
|
||||
set to False to get only redirectpages,
|
||||
unset/None results in not filtering
|
||||
@type filter_redirects bool/None
|
||||
|
||||
"""
|
||||
# Iterate over articles in redfam
|
||||
for article in self._articlesList:
|
||||
page = pywikibot.Page(pywikibot.Link(article), self.site)
|
||||
|
||||
# Exclude by article status
|
||||
for status in exclude_article_status:
|
||||
if self.article_has_status( status, title=article ):
|
||||
continue
|
||||
|
||||
# Only include by article status
|
||||
for status in onlyinclude_article_status:
|
||||
if not self.article_has_status( status, title=article ):
|
||||
continue
|
||||
|
||||
# Filter non existing Pages if requested with filter_existing=True
|
||||
if filter_existing and not page.exists():
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user