Xqt has submitted this change and it was merged.
Change subject: Workarround for overwrite conflict.
......................................................................
Workarround for overwrite conflict.
bug: T93364
Change-Id: I485d9fab83f6e9daec7ca38e8573eca5e37fd1cc
---
M checkvotes.py
1 file changed, 6 insertions(+), 3 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
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: merged
Gerrit-Change-Id: I485d9fab83f6e9daec7ca38e8573eca5e37fd1cc
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits