Ricordisamoa has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/135405

Change subject: BREAKING: do not change 'globe-coordinate' to 'globecoordinate'
......................................................................

BREAKING: do not change 'globe-coordinate' to 'globecoordinate'

when deserializing claims;
while this is technically a breaking change, it is for cleanup
purposes, and is unlikely to have serious consequences

Change-Id: Ie0add58d3a5d795a0258b2d1a06ea6216d50b8e1
---
M pywikibot/page.py
M pywikibot/site.py
M scripts/claimit.py
3 files changed, 4 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/05/135405/1

diff --git a/pywikibot/page.py b/pywikibot/page.py
index b40ec42..20cd00d 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2868,7 +2868,7 @@
                 claim.target = ItemPage(site, 'Q' + str(value['numeric-id']))
             elif claim.getType() == 'commonsMedia':
                 claim.target = ImagePage(site.image_repository(), value)
-            elif claim.getType() == 'globecoordinate':
+            elif claim.getType() == 'globe-coordinate':
                 claim.target = pywikibot.Coordinate.fromWikibase(value, site)
             elif claim.getType() == 'time':
                 claim.target = pywikibot.WbTime.fromWikibase(value)
@@ -2922,7 +2922,7 @@
         types = {'wikibase-item': ItemPage,
                  'string': basestring,
                  'commonsMedia': ImagePage,
-                 'globecoordinate': pywikibot.Coordinate,
+                 'globe-coordinate': pywikibot.Coordinate,
                  'url': basestring,
                  'time': pywikibot.WbTime,
                  'quantity': pywikibot.WbQuantity,
@@ -3054,7 +3054,7 @@
             value = self.getTarget()
         elif self.getType() == 'commonsMedia':
             value = self.getTarget().title(withNamespace=False)
-        elif self.getType() in ('globecoordinate', 'time', 'quantity'):
+        elif self.getType() in ('globe-coordinate', 'time', 'quantity'):
             value = self.getTarget().toWikibase()
         else:
             raise NotImplementedError('%s datatype is not supported yet.'
diff --git a/pywikibot/site.py b/pywikibot/site.py
index e6743b2..5465a63 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3672,9 +3672,6 @@
         except KeyError:
             dtype = data['entities'][prop.getID().lower()]['datatype']
 
-        if dtype == 'globe-coordinate':
-            dtype = 'globecoordinate'
-            # TODO Fix this
         return dtype
 
     @must_be(group='user')
diff --git a/scripts/claimit.py b/scripts/claimit.py
index bf01b55..0d3a8a4 100755
--- a/scripts/claimit.py
+++ b/scripts/claimit.py
@@ -174,7 +174,7 @@
             target = pywikibot.ItemPage(repo, commandline_claims[i + 1])
         elif claim.getType() == 'string':
             target = commandline_claims[i + 1]
-        elif claim.getType() == 'globecoordinate':
+        elif claim.getType() == 'globe-coordinate':
             coord_args = map(float, commandline_claims[i + 1].split(','))
             if len(coord_args) >= 3:
                 precision = coord_args[2]

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie0add58d3a5d795a0258b2d1a06ea6216d50b8e1
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <[email protected]>

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

Reply via email to