Xqt has submitted this change and it was merged.
Change subject: Bug 55610 - time data error ......................................................................
Bug 55610 - time data error
Removed timestamp format conversion in xmlreader.py [now in will be returned in ISO 8601 (no timezone), as from API]
Conversion from ISO 8601 (no timezone) to MediaWiki format is done in wikipedia.py, using parsetime2stamp().
Change-Id: I0ce152b2bb85a33a0b91b2b95879f9a90a4268f4 --- M wikipedia.py M xmlreader.py 2 files changed, 4 insertions(+), 14 deletions(-)
Approvals: Xqt: Looks good to me, approved
diff --git a/wikipedia.py b/wikipedia.py index 12eee21..1b27881 100644 --- a/wikipedia.py +++ b/wikipedia.py @@ -5105,7 +5105,7 @@ # Sometimes query does not contains revisions # or some pages are missing. Deactivate api call and use the # old API special:export - if self.site.has_api() and logger.isEnabledFor(DEBUG): + if self.site.has_api() and logger.isEnabledFor(DEBUG): while True: try: data = self.getDataApi() @@ -5200,11 +5200,8 @@ page2._revisionId = revisionId page2._editTime = parsetime2stamp(timestamp) page2._versionhistory = [ - (revisionId, - time.strftime("%Y-%m-%dT%H:%M:%SZ", - time.strptime(str(timestamp), - "%Y%m%d%H%M%S")), - username, entry.comment)] + (revisionId, timestamp, username, entry.comment) + ] section = page2.section() # Store the content page2._contents = text diff --git a/xmlreader.py b/xmlreader.py index 344ddf5..d4568af 100644 --- a/xmlreader.py +++ b/xmlreader.py @@ -189,18 +189,11 @@ text = self.text.rstrip('\n ') # Replace newline by cr/nl text = u'\r\n'.join(text.split('\n')) - # Decode the timestamp - timestamp = (self.timestamp[0:4]+ - self.timestamp[5:7]+ - self.timestamp[8:10]+ - self.timestamp[11:13]+ - self.timestamp[14:16]+ - self.timestamp[17:19]) self.title = self.title.strip() # Report back to the caller entry = XmlEntry(self.title, self.ns, self.id, text, self.username, - self.ipedit, timestamp, + self.ipedit, self.timestamp, self.editRestriction, self.moveRestriction, self.revisionid, self.comment, self.isredirect) self.inRevisionTag = False
pywikibot-commits@lists.wikimedia.org