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

Change subject: Require site object only for older MediaWiki installations
......................................................................


Require site object only for older MediaWiki installations

The patch in Ifbc3fc0f324c7483f0eba092529a05a8f617ec8c introduced
the need for providing a Site object with WbQuantity to ensure
correct handling of missing error bounds. This affects anyone
working with Wikidata.

This patch changes the behaviour so that Wikidata users can continue
as before and Site objects are only needed for users of older
MediaWiki installations. It also ensures that Wikidata users do not
accidentally go on assuming +/-0 error bounds as default.

See T150210 for discussions.

Bug: T150210
Change-Id: I406db1e86dff772dae7af557859f1458ca87ba5d
---
M pywikibot/__init__.py
M tests/wikibase_tests.py
2 files changed, 4 insertions(+), 2 deletions(-)

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



diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 42b93ec..c588b2c 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -609,7 +609,7 @@
             warning(
                 "WbQuantity now expects a 'site' parameter. This is needed to "
                 "ensure correct handling of error bounds.")
-            return True
+            return False
         return MediaWikiVersion(site.version()) < 
MediaWikiVersion('1.29.0-wmf.2')
 
     @staticmethod
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 8a18771..bad82ba 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -265,10 +265,12 @@
 
     def test_WbQuantity_fromWikibase(self):
         """Test WbQuantity.fromWikibase() instantiating."""
+        repo = self.get_repo()
         q = pywikibot.WbQuantity.fromWikibase({u'amount': u'+0.0229',
                                                u'lowerBound': u'0',
                                                u'upperBound': u'1',
-                                               u'unit': u'1'})
+                                               u'unit': u'1'},
+                                              site=repo)
         # note that the bounds are inputted as INT but are returned as FLOAT
         self.assertEqual(q.toWikibase(),
                          {'amount': '+0.0229', 'lowerBound': '+0.0000',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I406db1e86dff772dae7af557859f1458ca87ba5d
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <lokal.pro...@gmail.com>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: John Vandenberg <jay...@gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Strainu <w...@strainu.ro>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to