jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/598876 )
Change subject: [bugix] replace SpamfilterError exceptions ......................................................................
[bugix] replace SpamfilterError exceptions
Bug: T253681 Bug: T249436 Change-Id: I2cd8a65de22ee9db03f005c25f2ef836ba02f78a --- M scripts/add_text.py M scripts/blockpageschecker.py M scripts/interwiki.py M scripts/isbn.py M scripts/noreferences.py M scripts/weblinkchecker.py M tests/edit_failure_tests.py 7 files changed, 14 insertions(+), 13 deletions(-)
Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/add_text.py b/scripts/add_text.py index 0eadbc5..42a5c80 100755 --- a/scripts/add_text.py +++ b/scripts/add_text.py @@ -140,7 +140,7 @@ else: raise pywikibot.ServerError( 'Server Error! Maximum retries exceeded') - except pywikibot.SpamfilterError as e: + except pywikibot.SpamblacklistError as e: pywikibot.output( 'Cannot change {} because of blacklist entry {}' .format(page.title(), e.url)) diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py index 2398cd4..32b8aba 100755 --- a/scripts/blockpageschecker.py +++ b/scripts/blockpageschecker.py @@ -499,7 +499,7 @@ else: # Prevent Infinite Loops raise pywikibot.ServerError('Fifth Server Error!') - except pywikibot.SpamfilterError as e: + except pywikibot.SpamblacklistError as e: pywikibot.output('Cannot change %s because of ' 'blacklist entry %s' % (page.title(), e.url)) diff --git a/scripts/interwiki.py b/scripts/interwiki.py index f76aa75..e6894ca 100755 --- a/scripts/interwiki.py +++ b/scripts/interwiki.py @@ -1793,12 +1793,12 @@ 'ERROR putting page: An edit conflict occurred. ' 'Giving up.') raise SaveError('Edit conflict') - except (pywikibot.SpamfilterError) as error: + except pywikibot.SpamblacklistError as error: pywikibot.output( 'ERROR putting page: {0} blacklisted by spamfilter. ' 'Giving up.'.format(error.url)) raise SaveError('Spam filter') - except (pywikibot.PageNotSaved) as error: + except pywikibot.PageNotSaved as error: pywikibot.output('ERROR putting page: {}' .format(error.args,)) raise SaveError('PageNotSaved') diff --git a/scripts/isbn.py b/scripts/isbn.py index 429574c..2f53779 100755 --- a/scripts/isbn.py +++ b/scripts/isbn.py @@ -196,7 +196,7 @@ except pywikibot.EditConflict: pywikibot.output('Skipping {0} because of edit conflict' .format(page.title())) - except pywikibot.SpamfilterError as e: + except pywikibot.SpamblacklistError as e: pywikibot.output( 'Cannot change {0} because of blacklist entry {1}' .format(page.title(), e.url)) diff --git a/scripts/noreferences.py b/scripts/noreferences.py index cfe873a..390eb03 100755 --- a/scripts/noreferences.py +++ b/scripts/noreferences.py @@ -30,7 +30,7 @@ a list of affected articles """ # -# (C) Pywikibot team, 2007-2019 +# (C) Pywikibot team, 2007-2020 # # Distributed under the terms of the MIT license. # @@ -727,7 +727,7 @@ except pywikibot.EditConflict: pywikibot.warning('Skipping {0} because of edit conflict' .format(page.title(as_link=True))) - except pywikibot.SpamfilterError as e: + except pywikibot.SpamblacklistError as e: pywikibot.warning( 'Cannot change {0} because of blacklist entry {1}' .format(page.title(as_link=True), e.url)) diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py index 9830e67..f81a34e 100755 --- a/scripts/weblinkchecker.py +++ b/scripts/weblinkchecker.py @@ -105,7 +105,7 @@ python pwb.py weblinkchecker -repeat """ # -# (C) Pywikibot team, 2005-2019 +# (C) Pywikibot team, 2005-2020 # # Distributed under the terms of the MIT license. # @@ -846,9 +846,9 @@ 'weblinkchecker-summary')) try: talkPage.put(content, comment) - except pywikibot.SpamfilterError as error: + except pywikibot.SpamblacklistError as error: pywikibot.output(color_format( - '{lightaqua}** SpamfilterError while trying to ' + '{lightaqua}** SpamblacklistError while trying to ' 'change {0}: {1}{default}', talkPage.title(as_link=True), error.url))
diff --git a/tests/edit_failure_tests.py b/tests/edit_failure_tests.py index 37c8c14..05df87d 100644 --- a/tests/edit_failure_tests.py +++ b/tests/edit_failure_tests.py @@ -8,7 +8,7 @@ These tests use special code 'write = -1' for edit failures. """ # -# (C) Pywikibot team, 2014-2019 +# (C) Pywikibot team, 2014-2020 # # Distributed under the terms of the MIT license. # @@ -20,7 +20,7 @@ Error, NoPage, LockedPage, - SpamfilterError, + SpamblacklistError, TitleblacklistError, OtherPageSaveError, NoCreateError, @@ -54,7 +54,8 @@ page = pywikibot.Page(self.site, 'Wikipedia:Sandbox') page.text = 'http://badsite.com' try: - self.assertRaisesRegex(SpamfilterError, 'badsite.com', page.save) + self.assertRaisesRegex(SpamblacklistError, 'badsite.com', + page.save) except OtherPageSaveError as e: self.skipTest(e)
pywikibot-commits@lists.wikimedia.org