jenkins-bot has submitted this change and it was merged.
Change subject: improvements to APISite#rollbackpage()
......................................................................
improvements to APISite#rollbackpage()
- removed unused variable 'summary'
- used **kwargs to support custom arguments
Change-Id: Ic1a56f1742df6c55bb4c498f2670585d65c8ed41
---
M pywikibot/site.py
1 file changed, 5 insertions(+), 7 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 2d2d243..cc27276 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2989,15 +2989,16 @@
"alreadyrolled": "Page [[%(title)s]] already rolled back; action
aborted.",
} # other errors shouldn't arise because we check for those errors
- def rollbackpage(self, page, summary=u''):
+ def rollbackpage(self, page, **kwargs):
"""Roll back page to version before last user's edits.
+
+ The keyword arguments are those supported by the rollback API.
As a precaution against errors, this method will fail unless
the page history contains at least two revisions, and at least
one that is not by the same user who made the last edit.
@param page: the Page to be rolled back (must exist)
- @param summary: edit summary (defaults to a standardized message)
"""
if len(page._revisions) < 2:
@@ -3015,16 +3016,13 @@
raise pywikibot.Error(
u"Rollback of %s aborted; only one user in revision history."
% page.title(asLink=True))
- summary = summary or (
- u"Reverted edits by
[[Special:Contributions/%(last_user)s|%(last_user)s]] "
- u"([[User talk:%(last_user)s|Talk]]) to last version by
%(prev_user)s"
- % locals())
token = self.token(page, "rollback")
self.lock_page(page)
req = api.Request(site=self, action="rollback",
title=page.title(withSection=False),
user=last_user,
- token=token)
+ token=token,
+ **kwargs)
try:
result = req.submit()
except api.APIError as err:
--
To view, visit
https://gerrit.wikimedia.org/r/135421
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic1a56f1742df6c55bb4c498f2670585d65c8ed41
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>