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 <[email protected]> Gerrit-Reviewer: John Vandenberg <[email protected]> Gerrit-Reviewer: Ladsgroup <[email protected]> Gerrit-Reviewer: Legoktm <[email protected]> Gerrit-Reviewer: Merlijn van Deen <[email protected]> Gerrit-Reviewer: Mpaa <[email protected]> Gerrit-Reviewer: Multichill <[email protected]> Gerrit-Reviewer: Ricordisamoa <[email protected]> Gerrit-Reviewer: Russell Blau <[email protected]> Gerrit-Reviewer: Xqt <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
