Merge branch 'fs#138-marked-articles-shown-again' into develop
This commit is contained in:
@@ -268,6 +268,10 @@ class MarkPagesBot( CurrentPageBot ): # sets 'current_page' on each treat()
|
|||||||
"""
|
"""
|
||||||
Checks if disc notice which shall be added is already present.
|
Checks if disc notice which shall be added is already present.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if self.disc_notice in self.current_wikicode:
|
||||||
|
return True
|
||||||
|
|
||||||
# Iterate over Templates with same name (if any) to search equal
|
# Iterate over Templates with same name (if any) to search equal
|
||||||
# Link to decide if they are the same
|
# Link to decide if they are the same
|
||||||
for present_notice in self.current_wikicode.ifilter_templates(
|
for present_notice in self.current_wikicode.ifilter_templates(
|
||||||
|
|||||||
@@ -515,46 +515,67 @@ class RedFamWorker( RedFam ):
|
|||||||
@type filter_redirects bool/None
|
@type filter_redirects bool/None
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Helper to leave multidimensional loop
|
||||||
|
# https://docs.python.org/3/faq/design.html#why-is-there-no-goto
|
||||||
|
class Continue(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Break(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
# Iterate over articles in redfam
|
# Iterate over articles in redfam
|
||||||
for article in self.articlesList:
|
for article in self.articlesList:
|
||||||
# Not all list elements contain articles
|
|
||||||
if not article:
|
# To be able to control outer loop from inside child loops
|
||||||
|
try:
|
||||||
|
|
||||||
|
# Not all list elements contain articles
|
||||||
|
if not article:
|
||||||
|
raise Break()
|
||||||
|
|
||||||
|
page = pywikibot.Page( pywikibot.Link(article),
|
||||||
|
pywikibot.Site() )
|
||||||
|
|
||||||
|
# Filter existing pages if requested with filter_existing=False
|
||||||
|
if page.exists():
|
||||||
|
self.article_remove_status( "deleted", title=article )
|
||||||
|
if filter_existing is False:
|
||||||
|
raise Continue()
|
||||||
|
# Filter non existing Pages if requested with
|
||||||
|
# filter_existing=True
|
||||||
|
else:
|
||||||
|
self.article_add_status( "deleted", title=article )
|
||||||
|
if filter_existing:
|
||||||
|
raise Continue()
|
||||||
|
|
||||||
|
# Filter redirects if requested with filter_redirects=True
|
||||||
|
if page.isRedirectPage():
|
||||||
|
self.article_add_status( "redirect", title=article )
|
||||||
|
if filter_redirects:
|
||||||
|
raise Continue()
|
||||||
|
# Filter noredirects if requested with filter_redirects=False
|
||||||
|
else:
|
||||||
|
self.article_remove_status("redirect", title=article )
|
||||||
|
if filter_redirects is False:
|
||||||
|
raise Continue()
|
||||||
|
|
||||||
|
# Exclude by article status
|
||||||
|
for status in exclude_article_status:
|
||||||
|
if self.article_has_status( status, title=article ):
|
||||||
|
raise Continue()
|
||||||
|
|
||||||
|
# Only include by article status
|
||||||
|
for status in onlyinclude_article_status:
|
||||||
|
if not self.article_has_status( status, title=article ):
|
||||||
|
raise Continue()
|
||||||
|
|
||||||
|
# Proxy loop control to outer loop
|
||||||
|
except Continue:
|
||||||
|
continue
|
||||||
|
except Break:
|
||||||
break
|
break
|
||||||
|
|
||||||
page = pywikibot.Page(pywikibot.Link(article), pywikibot.Site())
|
|
||||||
|
|
||||||
# Filter existing pages if requested with filter_existing=False
|
|
||||||
if page.exists():
|
|
||||||
self.article_remove_status( "deleted", title=article )
|
|
||||||
if filter_existing is False:
|
|
||||||
continue
|
|
||||||
# Filter non existing Pages if requested with filter_existing=True
|
|
||||||
else:
|
|
||||||
self.article_add_status( "deleted", title=article )
|
|
||||||
if filter_existing:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Filter redirects if requested with filter_redirects=True
|
|
||||||
if page.isRedirectPage():
|
|
||||||
self.article_add_status( "redirect", title=article )
|
|
||||||
if filter_redirects:
|
|
||||||
continue
|
|
||||||
# Filter noredirects if requested with filter_redirects=False
|
|
||||||
else:
|
|
||||||
self.article_remove_status("redirect", title=article )
|
|
||||||
if filter_redirects is False:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# Yield filtered pages
|
# Yield filtered pages
|
||||||
yield page
|
yield page
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user