jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/636426 )
Change subject: [IMPR] Move page checks to skip_page ......................................................................
[IMPR] Move page checks to skip_page
Change-Id: I2c57975066089165e6bd827d99c77ab6c769189e --- M scripts/noreferences.py 1 file changed, 15 insertions(+), 11 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/noreferences.py b/scripts/noreferences.py index c2f3544..fec70ba 100755 --- a/scripts/noreferences.py +++ b/scripts/noreferences.py @@ -707,6 +707,21 @@ ident=ident, text=self.referencesText) return oldText[:index].rstrip() + ref_section + oldText[index:]
+ def skip_page(self, page): + """Check whether the page could be processed.""" + if page.isDisambig(): + pywikibot.output('Page {} is a disambig; skipping.' + .format(page.title(as_link=True))) + return True + + if self.site.sitename == 'wikipedia:en' and page.isIpEdit(): + pywikibot.warning( + 'Page {} is edited by IP. Possible vandalized' + .format(page.title(as_link=True))) + return True + + return super().skip_page(page) + def treat_page(self) -> None: """Run the bot.""" page = self.current_page @@ -717,17 +732,6 @@ .format(page.title(as_link=True))) return
- if page.isDisambig(): - pywikibot.output('Page {0} is a disambig; skipping.' - .format(page.title(as_link=True))) - return - - if self.site.sitename == 'wikipedia:en' and page.isIpEdit(): - pywikibot.warning( - 'Page {0} is edited by IP. Possible vandalized' - .format(page.title(as_link=True))) - return - if self.lacksReferences(text): newText = self.addReferences(text) try:
pywikibot-commits@lists.wikimedia.org