Ricordisamoa has uploaded a new change for review.

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

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, 4 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/21/135421/1

diff --git a/pywikibot/site.py b/pywikibot/site.py
index e6743b2..68d5b1a 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2933,7 +2933,7 @@
         "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.
 
         As a precaution against errors, this method will fail unless
@@ -2959,16 +2959,15 @@
             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)
+        for kwarg in kwargs:
+            if kwarg in ('summary', 'markbot', 'watchlist'):
+                req[kwarg] = kwargs[kwarg]
         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: newchange
Gerrit-Change-Id: Ic1a56f1742df6c55bb4c498f2670585d65c8ed41
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <[email protected]>

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

Reply via email to