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.
|
||||
"""
|
||||
|
||||
if self.disc_notice in self.current_wikicode:
|
||||
return True
|
||||
|
||||
# Iterate over Templates with same name (if any) to search equal
|
||||
# Link to decide if they are the same
|
||||
for present_notice in self.current_wikicode.ifilter_templates(
|
||||
|
||||
@@ -515,45 +515,66 @@ class RedFamWorker( RedFam ):
|
||||
@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
|
||||
for article in self.articlesList:
|
||||
|
||||
# To be able to control outer loop from inside child loops
|
||||
try:
|
||||
|
||||
# Not all list elements contain articles
|
||||
if not article:
|
||||
break
|
||||
raise Break()
|
||||
|
||||
page = pywikibot.Page(pywikibot.Link(article), pywikibot.Site())
|
||||
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
|
||||
raise Continue()
|
||||
# Filter non existing Pages if requested with
|
||||
# filter_existing=True
|
||||
else:
|
||||
self.article_add_status( "deleted", title=article )
|
||||
if filter_existing:
|
||||
continue
|
||||
raise Continue()
|
||||
|
||||
# Filter redirects if requested with filter_redirects=True
|
||||
if page.isRedirectPage():
|
||||
self.article_add_status( "redirect", title=article )
|
||||
if filter_redirects:
|
||||
continue
|
||||
raise Continue()
|
||||
# Filter noredirects if requested with filter_redirects=False
|
||||
else:
|
||||
self.article_remove_status("redirect", title=article )
|
||||
if filter_redirects is False:
|
||||
continue
|
||||
raise Continue()
|
||||
|
||||
# Exclude by article status
|
||||
for status in exclude_article_status:
|
||||
if self.article_has_status( status, title=article ):
|
||||
continue
|
||||
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
|
||||
|
||||
# Yield filtered pages
|
||||
yield page
|
||||
|
||||
Reference in New Issue
Block a user