jenkins-bot has submitted this change and it was merged.
Change subject: improvements to pywikibot.Bot#userPut() ......................................................................
improvements to pywikibot.Bot#userPut()
- add **kwargs to support parameters like 'comment', 'minor', 'botflag' - option to override 'async' - use page.text assignment and page.save() instead of page.put()
Change-Id: I7ba6430ae1be0a969b86baf8b16062fa9636f9aa --- M pywikibot/bot.py 1 file changed, 6 insertions(+), 2 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py index 2c2e2b5..fb979ea 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -788,7 +788,7 @@ except KeyError: raise pywikibot.Error(u'%s is not a valid bot option.' % option)
- def userPut(self, page, oldtext, newtext): + def userPut(self, page, oldtext, newtext, **kwargs): """ Print differences, ask user for confirmation, and puts the page if needed. @@ -817,8 +817,12 @@ # Remember the choice self.options['always'] = True
+ if 'async' not in kwargs: + kwargs['async'] = (choice == 'a') + if choice != 'n': - page.put(newtext, async=(choice == 'a')) + page.text = newtext + page.save(**kwargs)
class WikidataBot: