Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270598

Change subject: Workarround for overwrite conflict.
......................................................................

Workarround for overwrite conflict.

bug: T793364
Change-Id: I485d9fab83f6e9daec7ca38e8573eca5e37fd1cc
---
M checkvotes.py
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot 
refs/changes/98/270598/1

diff --git a/checkvotes.py b/checkvotes.py
index 5c7c09f..6404e4c 100644
--- a/checkvotes.py
+++ b/checkvotes.py
@@ -516,8 +516,8 @@
     def load(self, page):
         """Load the given page, does some changes, and save it."""
         try:
-            # Load the page
-            text = page.get()
+            # Load the preloaded page
+            page.get()
         except pywikibot.NoPage:
             pywikibot.output('\nPage %s does not exist; skipping.'
                              % page.title(asLink=True))
@@ -525,6 +525,8 @@
             pywikibot.output('\nPage %s is a redirect; skipping.'
                              % page.title(asLink=True))
         else:
+            # page.getRestrictions() may delete the content
+            # if revision ID has been changed (bug: T93364)
             restrictions = page.getRestrictions()  # TODO: für Prüfung hier 
ausschließen
             if restrictions:
                 if 'edit' in restrictions and restrictions['edit']:
@@ -532,7 +534,8 @@
                         pywikibot.output('\nPage %s is locked; skipping.'
                                          % page.title(asLink=True))
                         return
-            return text
+            # return the text - may be reloaded after getRestrictions()
+            return page.text
 
     def save(self, text, page, comment, minorEdit=True, botflag=True):
         # only save if something was changed

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I485d9fab83f6e9daec7ca38e8573eca5e37fd1cc
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to