Gerrit Patch Uploader has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/333033 )

Change subject: [bugfix] Menage temporary readonly error
......................................................................

[bugfix] Menage temporary readonly error

It's look like the API error named internal_api_error_ReadOnlyError was renamed 
to readonly. So, code.startswith(u'internal_api_error_') is not enabled. I've 
edited the code to accept readonly as an error that need edit retry. Need 
investigation to verify if internal_api_error_ReadOnlyError is still enabled, 
and if others error codes are impacted.

Bug: T154011
Change-Id: I9cc80c77532db3d9b71db5c33f91b8a699f41d6c
---
M pywikibot/data/api.py
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/33/333033/1

diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 4b251eb..decfbfe 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -2089,15 +2089,20 @@
 
             pywikibot.warning('API error %s: %s' % (code, info))
 
-            if code.startswith(u'internal_api_error_'):
-                class_name = code[len(u'internal_api_error_'):]
+            if code.startswith(u'internal_api_error_') or code == 'readonly':
+                if code == 'readonly':  # T154011
+                    class_name = code
+                else:
+                    class_name = code[len(u'internal_api_error_'):]
 
                 del error['code']  # is added via class_name
                 e = APIMWException(class_name, **error)
 
+                # If the error key is in this table, it is probably a 
temporary problem, so whe will retry the edit
                 retry = class_name in ['DBConnectionError',  # T64974
                                        'DBQueryError',  # T60158
-                                       'ReadOnlyError'  # T61227
+                                       'ReadOnlyError',  # T61227 #TODO: seems 
replaced by 'readonly' # T154011
+                                       'readonly'  # T154011
                                        ]
 
                 pywikibot.error("Detected MediaWiki API exception %s%s"

-- 
To view, visit https://gerrit.wikimedia.org/r/333033
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9cc80c77532db3d9b71db5c33f91b8a699f41d6c
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com>
Gerrit-Reviewer: Framawiki <framaw...@tools.wmflabs.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to