jenkins-bot merged this change.
[deprecate] Deprecate Page.put_async()
- Page.put_async is the async version of Page.put() and maintained
solely for backwards-compatibility. It could be easily replaced
by Page.put(asynchronous=True) or Page.save(asynchronous=True).
- Mark Page.put_async as deprecated.
- Update some scripts accordingly
- Change README-conversion.txt and compat2core.py script
Bug: T193494
Change-Id: Ic96e37fde18cbaa98751cb2b0b17cb1b0020f8a3
---
M README-conversion.txt
M pywikibot/page.py
M scripts/catall.py
M scripts/maintenance/compat2core.py
M scripts/solve_disambiguation.py
5 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/README-conversion.txt b/README-conversion.txt
index 1d17d22..b033f65 100644
--- a/README-conversion.txt
+++ b/README-conversion.txt
@@ -36,7 +36,7 @@
change "wikipedia." to "pywikibot."
wikipedia.setAction() no longer works; you must revise the script to pass an
-explicit edit summary message on each put() or put_async() call.
+explicit edit summary message on each put() call.
There is a helper script which does a lot of changes automatically.
Just call it:
@@ -77,6 +77,7 @@
- sectionFreeTitle(): replaced by Page.title(withSection=False)
- aslink(): replaced by Page.title(asLink=True)
- encoding(): replaced by Page.site.encoding()
+- put_async(): replaced by Page.put(asynchronous=True)
The following methods of the Page object have been obsoleted and no longer
work (but these methods don't appear to be used anywhere in the code
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 0766f63..e7759e6 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1347,13 +1347,13 @@
@param newtext: The complete text of the revised page.
@type newtext: unicode
-
"""
self.text = newtext
self.save(summary=summary, watch=watch, minor=minor, botflag=botflag,
force=force, asynchronous=asynchronous, callback=callback,
**kwargs)
+ @deprecated('put(asynchronous=True) or save(asynchronous=True)')
@deprecated_args(comment='summary', watchArticle='watch',
minorEdit='minor')
def put_async(self, newtext, summary=None, watch=None, minor=True,
diff --git a/scripts/catall.py b/scripts/catall.py
index 76ffc85..73ec62f 100755
--- a/scripts/catall.py
+++ b/scripts/catall.py
@@ -21,7 +21,7 @@
"""
#
# (C) Rob W.W. Hooft, Andre Engels, 2004
-# (C) Pywikibot team, 2004-2014
+# (C) Pywikibot team, 2004-2018
#
# Distributed under the terms of the MIT license.
#
@@ -77,9 +77,9 @@
for p in list:
cattitle = "%s:%s" % (site.namespaces.CATEGORY, p)
pllist.append(pywikibot.Page(site, cattitle))
- page.put_async(textlib.replaceCategoryLinks(page.get(), pllist,
- site=page.site),
- summary=i18n.twtranslate(site, 'catall-changing'))
+ page.put(textlib.replaceCategoryLinks(page.get(), pllist, site=page.site),
+ asynchronous=True,
+ summary=i18n.twtranslate(site, 'catall-changing'))
def main(*args):
diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py
index 49ec2fc..35066a5 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -27,7 +27,7 @@
"""
#
# (C) xqt, 2014-2017
-# (C) Pywikibot team, 2014-2017
+# (C) Pywikibot team, 2014-2018
#
# Distributed under the terms of the MIT license.
#
@@ -93,7 +93,7 @@
warnings = (
('pywikibot.setAction(',
'setAction() no longer works; you must pass an explicit edit summary\n'
- 'message to put() or put_async()'),
+ 'message to save() or put()'),
('.removeImage(',
'Page.removeImage() is deprecated and does not work at core'),
('.replaceImage(',
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 2d662e8..769293a 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -768,7 +768,8 @@
redir_text = '#%s [[%s]]' \
% (self.mysite.redirect(), target)
try:
- refPage.put_async(redir_text, summary=self.comment)
+ refPage.put(redir_text, summary=self.comment,
+ asynchronous=True)
except pywikibot.PageNotSaved as error:
pywikibot.output(u'Page not saved: %s' % error.args)
else:
@@ -989,7 +990,7 @@
self.setSummaryMessage(disambPage, new_targets, unlink_counter,
dn)
try:
- refPage.put_async(text, summary=self.comment)
+ refPage.put(text, summary=self.comment, asynchronous=True)
except pywikibot.LockedPage:
pywikibot.output(u'Page not saved: page is locked')
except pywikibot.PageNotSaved as error:
To view, visit change 430073. To unsubscribe, visit settings.