jenkins-bot has submitted this change and it was merged.

Change subject: [IMPROV] Site: Warn more detailed if site to old
......................................................................


[IMPROV] Site: Warn more detailed if site to old

If the site to old and the value would be valid for new versions, it's
specifically saying that the site doesn't support that value and not
that the value is invalid at all.

Change-Id: I1a00a8dbcb5a4ee94d89222543e574f14a77184e
---
M pywikibot/site.py
1 file changed, 8 insertions(+), 6 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/site.py b/pywikibot/site.py
index 188272a..973edaf 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4008,14 +4008,16 @@
             params['createonly'] = ""
         if nocreate:
             params['nocreate'] = ""
-        watch_items = ["watch", "unwatch"]
-        if MediaWikiVersion(self.version()) >= MediaWikiVersion("1.16"):
-            watch_items += ["preferences", "nochange"]
+        watch_items = set(["watch", "unwatch", "preferences", "nochange"])
         if watch in watch_items:
-            if MediaWikiVersion(self.version()) >= MediaWikiVersion("1.16"):
-                params['watchlist'] = watch
+            if MediaWikiVersion(self.version()) < MediaWikiVersion("1.16"):
+                if watch in ['preferences', 'nochange']:
+                    pywikibot.warning(u'The watch value {0} is not supported '
+                                      'by {1}'.format(watch, self))
+                else:
+                    params[watch] = ""
             else:
-                params[watch] = ""
+                params['watchlist'] = watch
         elif watch:
             pywikibot.warning(
                 u"editpage: Invalid watch value '%(watch)s' ignored."

-- 
To view, visit https://gerrit.wikimedia.org/r/182403
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1a00a8dbcb5a4ee94d89222543e574f14a77184e
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to