jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/333490 )
Change subject: Provide site to WbTime via WbTime.fromWikibase
......................................................................
Provide site to WbTime via WbTime.fromWikibase
And rename the argument to be consistent with other fromWikibase
classmethods.
Change-Id: Id11f6e3db71d489a0d9e00af40aa85998ecd1874
---
M pywikibot/__init__.py
M pywikibot/page.py
2 files changed, 9 insertions(+), 7 deletions(-)
Approvals:
Lokal Profil: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index cec265f..55f3a4f 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -658,17 +658,19 @@
return json
@classmethod
- def fromWikibase(cls, ts):
+ def fromWikibase(cls, wb, site=None):
"""
Create a WbTime from the JSON data given by the Wikibase API.
- @param ts: Wikibase JSON
- @type ts: dict
+ @param wb: Wikibase JSON
+ @type wb: dict
+ @param site: The Wikibase site
+ @type site: pywikibot.site.DataSite
@rtype: pywikibot.WbTime
"""
- return cls.fromTimestr(ts[u'time'], ts[u'precision'],
- ts[u'before'], ts[u'after'],
- ts[u'timezone'], ts[u'calendarmodel'])
+ return cls.fromTimestr(wb['time'], wb['precision'],
+ wb['before'], wb['after'],
+ wb['timezone'], wb['calendarmodel'],
site)
class WbQuantity(_WbRepresentation):
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 3794ee0..17557ff 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -4519,7 +4519,7 @@
FilePage(pywikibot.Site('commons', 'commons'), value), #
T90492
'globe-coordinate': pywikibot.Coordinate.fromWikibase,
'geo-shape': pywikibot.WbGeoShape.fromWikibase,
- 'time': lambda value, site: pywikibot.WbTime.fromWikibase(value),
+ 'time': pywikibot.WbTime.fromWikibase,
'quantity': pywikibot.WbQuantity.fromWikibase,
'monolingualtext': lambda value, site:
pywikibot.WbMonolingualText.fromWikibase(value)
--
To view, visit
https://gerrit.wikimedia.org/r/333490
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id11f6e3db71d489a0d9e00af40aa85998ecd1874
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <lokal.profil(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>