http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11562
Revision: 11562
Author: russblau
Date: 2013-05-19 17:33:17 +0000 (Sun, 19 May 2013)
Log Message:
-----------
Pass thru arbitrary arguments on save()
Modified Paths:
--------------
branches/rewrite/pywikibot/page.py
Modified: branches/rewrite/pywikibot/page.py
===================================================================
--- branches/rewrite/pywikibot/page.py 2013-05-19 16:43:40 UTC (rev 11561)
+++ branches/rewrite/pywikibot/page.py 2013-05-19 17:33:17 UTC (rev 11562)
@@ -730,7 +730,7 @@
return True
def save(self, comment=None, watch=None, minor=True, botflag=None,
- force=False, async=False, callback=None):
+ force=False, async=False, callback=None, **kwargs):
"""Save the current contents of page's text to the wiki.
@param comment: The edit summary for the modification (optional, but
@@ -773,19 +773,20 @@
if async:
pywikibot.async_request(self._save, comment=comment, minor=minor,
watchval=watchval, botflag=botflag,
- async=async, callback=callback)
+ async=async, callback=callback, **kwargs)
else:
self._save(comment=comment, minor=minor, watchval=watchval,
- botflag=botflag, async=async, callback=callback)
+ botflag=botflag, async=async, callback=callback,
+ **kwargs)
- def _save(self, comment, minor, watchval, botflag, async, callback):
+ def _save(self, comment, minor, watchval, botflag, async, callback, **kwargs):
err = None
link = self.title(asLink=True)
if config.cosmetic_changes:
comment = self._cosmetic_changes_hook(comment) or comment
try:
done = self.site.editpage(self, summary=comment, minor=minor,
- watch=watchval, bot=botflag)
+ watch=watchval, bot=botflag, **kwargs)
if not done:
pywikibot.warning(u"Page %s not saved" % link)
raise pywikibot.PageNotSaved(link)
@@ -839,7 +840,7 @@
return comment
def put(self, newtext, comment=u'', watchArticle=None, minorEdit=True,
- botflag=None, force=False, async=False, callback=None):
+ botflag=None, force=False, async=False, callback=None, **kwargs):
"""Save the page with the contents of the first argument as the
text.
This method is maintained primarily for backwards-compatibility.
@@ -853,10 +854,11 @@
self.text = newtext
return self.save(comment=comment, watch=watchArticle,
minor=minorEdit, botflag=botflag, force=force,
- async=async, callback=callback)
+ async=async, callback=callback, **kwargs)
def put_async(self, newtext, comment=u'', watchArticle=None,
- minorEdit=True, botflag=None, force=False, callback=None):
+ minorEdit=True, botflag=None, force=False, callback=None,
+ **kwargs):
"""Put page on queue to be saved to wiki asynchronously.
Asynchronous version of put (takes the same arguments), which places
@@ -867,7 +869,7 @@
"""
return self.put(newtext, comment=comment, watchArticle=watchArticle,
minorEdit=minorEdit, botflag=botflag, force=force,
- async=True, callback=callback)
+ async=True, callback=callback, **kwargs)
def watch(self, unwatch=False):
"""Add or remove this page to/from bot account's watchlist.