jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] page: Return unicode timestamps ......................................................................
[FIX] page: Return unicode timestamps
The timestamps in compat are returned directly from the API which are parsed as unicode instances. When 81d5291b returned several Timestamp instances now as strings it uses Timestamp.isoformat() which returns bytes in Python 2 so they need to be converted into unicode.
Change-Id: I92ef76a9988b6cccb42fffdd52a224850337ec49 --- M pywikibot/page.py 1 file changed, 4 insertions(+), 4 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index 7ea7337..4c91b02 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -1578,7 +1578,7 @@ @rtype: tuple(username, Timestamp) """ result = self.oldest_revision - return result.user, result.timestamp.isoformat() + return result.user, unicode(result.timestamp.isoformat())
@deprecated('contributors() or revisions()') @deprecated_args(limit="total") @@ -1590,7 +1590,7 @@ @param total: iterate no more than this number of revisions in total @rtype: list of dict, each dict containing the username and Timestamp """ - return [{'user': rev.user, 'timestamp': rev.timestamp.isoformat()} + return [{'user': rev.user, 'timestamp': unicode(rev.timestamp.isoformat())} for rev in self.revisions(total=total)]
@deprecate_arg("throttle", None) @@ -2230,7 +2230,7 @@
""" return [self.oldest_file_info.user, - self.oldest_file_info.timestamp.isoformat()] + unicode(self.oldest_file_info.timestamp.isoformat())]
@deprecated("FilePage.latest_file_info.user") def getLatestUploader(self): @@ -2240,7 +2240,7 @@
""" return [self.latest_file_info.user, - self.latest_file_info.timestamp.isoformat()] + unicode(self.latest_file_info.timestamp.isoformat())]
@deprecated('FilePage.get_file_history()') def getFileVersionHistory(self):
pywikibot-commits@lists.wikimedia.org