https://bugzilla.wikimedia.org/show_bug.cgi?id=64501
Bug ID: 64501 Summary: Modify pywikibot.Timestamp to support Wikidata Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: Wikidata Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: maarten@mdammers.nl CC: legoktm.wikipedia@gmail.com Web browser: --- Mobile Platform: ---
Pywikibot currently contains a Timestamp class (see https://git.wikimedia.org/blob/pywikibot%2Fcore.git/HEAD/pywikibot%2F__init_...).
This class should be modified like Coordinate to support Wikidata.
Example how to add a time claim:
'action' => 'wbcreateclaim', 'entity' => 'Q82', 'property' => 'P11', 'snaktype' => 'value', 'value' => '{"time":"+00000002010-01-02T00:00:00Z","timezone":0,"before":0,"after":0,"precision":11,"calendarmodel":"http://www.wikidata.org/entity/Q1985727%22%7D', 'bot' => 1,
(from https://www.mediawiki.org/wiki/Extension:Wikibase_Repository/API)
Should probably at least implement "toWikibase" and "fromWikibase"
https://bugzilla.wikimedia.org/show_bug.cgi?id=64501
Maarten Dammers maarten@mdammers.nl changed:
What |Removed |Added ---------------------------------------------------------------------------- Blocks| |64503
https://bugzilla.wikimedia.org/show_bug.cgi?id=64501
Mpaa mpaa.wiki@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mpaa.wiki@gmail.com
--- Comment #1 from Mpaa mpaa.wiki@gmail.com --- There is already class WbTime(object) with the methods above. Shouldn't we extend this class instead, with a method that accepts a pywikibot.Timestamp as input ("fromTimeStampToWbTime" or similar?)?
https://bugzilla.wikimedia.org/show_bug.cgi?id=64501
--- Comment #2 from Maarten Dammers maarten@mdammers.nl --- I completely overlooked WbTime. Shouldn't the two of them be merged into one object?
https://bugzilla.wikimedia.org/show_bug.cgi?id=64501
--- Comment #3 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- (In reply to Maarten Dammers from comment #2)
I completely overlooked WbTime. Shouldn't the two of them be merged into one object?
Ideally yes. But I don't believe it's possible.
pywikibot.Timestamp is an extension of datetime.datetime, which has a limit on how large dates it can handle. https://docs.python.org/2.7/library/datetime.html says the year has to be between 1 and 9999, but Wikibase supports much older dates, or dates farther in the future, which is why we needed WbTime.
I think creating a fromTimeStampToWbTime or similar function is probably the best way to handle it for now.
https://bugzilla.wikimedia.org/show_bug.cgi?id=64501
--- Comment #4 from Ricordisamoa ricordisamoa@live.it --- (In reply to Mpaa from comment #1)
There is already class WbTime(object) with the methods above. Shouldn't we extend this class instead, with a method that accepts a pywikibot.Timestamp as input ("fromTimeStampToWbTime" or similar?)?
pywikibot.WbTime.fromTimestr(timestamp.toISOformat()) already works perfectly.
(In reply to Maarten Dammers from comment #2)
I completely overlooked WbTime. Shouldn't the two of them be merged into one object?
Maybe, but WbTime has Wikibase-specific attributes like "precision", "after", "before" and "calendarmodel".
https://bugzilla.wikimedia.org/show_bug.cgi?id=64501
Amir Ladsgroup ladsgroup@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ladsgroup@gmail.com
--- Comment #5 from Amir Ladsgroup ladsgroup@gmail.com --- So I think closing this bug is okay, Does anyone disagree?
https://bugzilla.wikimedia.org/show_bug.cgi?id=64501
Ricordisamoa ricordisamoa@openmailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ricordisamoa@openmailbox.or | |g
--- Comment #6 from Ricordisamoa ricordisamoa@openmailbox.org --- Yes, WONTFIX.
https://bugzilla.wikimedia.org/show_bug.cgi?id=64501
Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |WONTFIX
https://bugzilla.wikimedia.org/show_bug.cgi?id=64501
Maarten Dammers maarten@mdammers.nl changed:
What |Removed |Added ---------------------------------------------------------------------------- Blocks|64503 |
pywikipedia-bugs@lists.wikimedia.org