jenkins-bot has submitted this change and it was merged.
Change subject: Backward compatibility: re-enable "watch" parameter for mw <
1.16
......................................................................
Backward compatibility: re-enable "watch" parameter for mw < 1.16
"watch" and "unwatch" is deprecated since mw 1.16 and the new
behaviour is introduces in
https://www.mediawiki.org/wiki/Special:Code/pywikipedia/8169
without backward compatibility. Re-enable the old api call for
older mw releases and warn operator with "Invalid watch value"
message if using new parameters for old mw release.
Change-Id: I0b03e077c5cf0798412f43d161bd643b2409f7a5
---
M pywikibot/site.py
1 file changed, 10 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 3628842..188272a 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3971,7 +3971,8 @@
to one of "watch", "unwatch", "preferences",
"nochange":
* watch: add the page to the watchlist
* unwatch: remove the page from the watchlist
- * preferences: use the preference settings (Default)
+ The following settings are supported by mw >= 1.16 only
+ * preferences: use the preference settings (default)
* nochange: don't change the watchlist
@param bot: if True, mark edit with bot flag
@return: True if edit succeeded, False if it failed
@@ -4007,8 +4008,14 @@
params['createonly'] = ""
if nocreate:
params['nocreate'] = ""
- if watch in ["watch", "unwatch", "preferences",
"nochange"]:
- params['watchlist'] = watch
+ watch_items = ["watch", "unwatch"]
+ if MediaWikiVersion(self.version()) >= MediaWikiVersion("1.16"):
+ watch_items += ["preferences", "nochange"]
+ if watch in watch_items:
+ if MediaWikiVersion(self.version()) >=
MediaWikiVersion("1.16"):
+ params['watchlist'] = watch
+ else:
+ params[watch] = ""
elif watch:
pywikibot.warning(
u"editpage: Invalid watch value '%(watch)s' ignored."
--
To view, visit
https://gerrit.wikimedia.org/r/144358
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0b03e077c5cf0798412f43d161bd643b2409f7a5
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>