jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] Do not recreate a deleted page
......................................................................
[bugfix] Do not recreate a deleted page
- assign newtext only once outside the loop and use Page.save method
- assign global.async to the async parameter
- use nocreate=True to prevent recreating the page_empty_check
- leave the method without further action when recreating fails
but show the default warnings
Bug: T143649
Change-Id: I2e441e1ae16acc2d016890f4a6aff5c9074bc286
---
M scripts/interwiki.py
1 file changed, 6 insertions(+), 4 deletions(-)
Approvals:
Thibaut120094: Looks good to me, but someone else must approve
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 3504c59..ab98a06 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -1952,12 +1952,14 @@
if not globalvar.quiet:
pywikibot.output(u"NOTE: Updating live wiki...")
timeout = 60
+ page.text = newtext
while True:
try:
- if globalvar.async:
- page.put_async(newtext, summary=mcomment)
- else:
- page.put(newtext, summary=mcomment)
+ page.save(summary=mcomment, async=globalvar.async,
+ nocreate=True)
+ except pywikibot.NoCreateError:
+ pywikibot.exception()
+ return False
except pywikibot.LockedPage:
pywikibot.output(u'Page %s is locked. Skipping.' % page)
raise SaveError(u'Locked')
--
To view, visit
https://gerrit.wikimedia.org/r/306179
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2e441e1ae16acc2d016890f4a6aff5c9074bc286
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <Ladsgroup(a)gmail.com>
Gerrit-Reviewer: Thibaut120094 <thibaut120094(a)outlook.fr>
Gerrit-Reviewer: jenkins-bot <>