jenkins-bot submitted this change.

View Change

Approvals: Multichill: Looks good to me, approved jenkins-bot: Verified
[bugfix] _is_wikibase_error_retryable rewritten

Check for 'wbeditentity' action with 'edit-already-exists' error only
(Bug: T48535)

Bug: T268645
Change-Id: Ie6487c140684eb03f8fa204c304997c992a8da66
---
M pywikibot/data/api.py
1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 40dee1a..c9f69a7 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1479,12 +1479,13 @@
return {action: {'result': 'Success', 'nochange': ''}}
return None

- @staticmethod
- def _is_wikibase_error_retryable(error):
- ERR_MSG = (
- 'edit-already-exists',
- 'actionthrottledtext', # T192912
- )
+ def _is_wikibase_error_retryable(self, error):
+ # dict of error message and current action.
+ # Value is True if action type is to be ignored
+ ERR_MSG = {
+ 'edit-already-exists': 'wbeditentity',
+ 'actionthrottledtext': True, # T192912, T268645
+ }
messages = error.get('messages')
message = None
# bug T68619; after Wikibase breaking change 1ca9cee change we have a
@@ -1492,14 +1493,19 @@
if isinstance(messages, list):
for item in messages:
message = item['name']
- if message in ERR_MSG:
+ action = ERR_MSG.get(message)
+ if action is True or action == self.action:
return True
- elif isinstance(messages, dict):
+ else:
+ return False
+
+ if isinstance(messages, dict):
try: # behaviour before gerrit 124323 breaking change
message = messages['0']['name']
except KeyError: # unsure the new output is always a list
message = messages['name']
- return message in ERR_MSG
+ action = ERR_MSG.get(message)
+ return action is True or action == self.action

@staticmethod
def _generate_mime_part(key, content, keytype=None, headers=None):
@@ -1935,7 +1941,6 @@

# Phab. tickets T48535, T64126, T68494, T68619
if code == 'failed-save' and \
- self.action == 'wbeditentity' and \
self._is_wikibase_error_retryable(result['error']):
self.wait()
continue

To view, visit change 643491. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie6487c140684eb03f8fa204c304997c992a8da66
Gerrit-Change-Number: 643491
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Mpaa <mpaa.wiki@gmail.com>
Gerrit-Reviewer: Multichill <maarten@mdammers.nl>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged