jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/701657 )
Change subject: [fix] Update handling of abusefilter-{disallow,warning} codes ......................................................................
[fix] Update handling of abusefilter-{disallow,warning} codes
The warning key is not in the response and was only included for backwards-compatibility temporarily.
Bug: T285317 Change-Id: Ib6ca7b2599cf20c40960c343dc7f0129d98d05c7 --- M pywikibot/exceptions.py M pywikibot/site/_apisite.py 2 files changed, 6 insertions(+), 8 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py index 136dc2a..e5e505e 100644 --- a/pywikibot/exceptions.py +++ b/pywikibot/exceptions.py @@ -543,12 +543,12 @@ """Page save failed because the AbuseFilter disallowed it."""
message = ('Edit to page %(title)s disallowed by the AbuseFilter.\n' - '%(info)s\n%(warning)s') + '%(info)s')
- def __init__(self, page, info, warning): + def __init__(self, page, info, other): """Initializer.""" self.info = info - self.warning = warning + self.other = other super().__init__(page)
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py index da2f734..40020ec 100644 --- a/pywikibot/site/_apisite.py +++ b/pywikibot/site/_apisite.py @@ -1637,10 +1637,8 @@ 'logged in'.format(err.code), _logger) if err.code == 'abusefilter-warning': - pywikibot.warning('{info}\n{warning}\nRetrying.' - .format(info=err.info, - warning=err.other['warning'], - )) + pywikibot.warning('{info}\nRetrying.' + .format(info=err.info)) continue if err.code in self._ep_errors: exception = self._ep_errors[err.code] @@ -1655,7 +1653,7 @@ if issubclass(exception, AbuseFilterDisallowedError): errdata = { 'info': err.info, - 'warning': err.other['warning'], + 'other': err.other, } raise exception(page, **errdata) from None if issubclass(exception, SpamblacklistError):