http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11703
Revision: 11703 Author: multichill Date: 2013-06-30 12:20:15 +0000 (Sun, 30 Jun 2013) Log Message: ----------- Globe can be null like at https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q9831&fo... . Than "data['globe']"==None so globes[data['globe']] will throw a Keyerror. Changed it to default to earth when it's null.
Modified Paths: -------------- branches/rewrite/pywikibot/__init__.py
Modified: branches/rewrite/pywikibot/__init__.py =================================================================== --- branches/rewrite/pywikibot/__init__.py 2013-06-30 02:03:30 UTC (rev 11702) +++ branches/rewrite/pywikibot/__init__.py 2013-06-30 12:20:15 UTC (rev 11703) @@ -164,9 +164,17 @@ for k in site.globes(): globes[site.globes()[k]] = k
+ globekey = data['globe'] + if globekey: + # FIXME: Should probably use get() with some error handling when it's an unknown globe + globe = globes[data['globe']] + else: + # Default to earth or should we use None here? + globe = 'earth' + return Coordinate(data['latitude'], data['longitude'], data['altitude'], data['precision'], - globes[data['globe']], site=site) + globe, site=site)
@property def precision(self):
pywikipedia-svn@lists.wikimedia.org