http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11595
Revision: 11595 Author: legoktm Date: 2013-05-30 07:29:04 +0000 (Thu, 30 May 2013) Log Message: ----------- Convert a few timestamp instaces to pywikibot.Timestamp
Modified Paths: -------------- branches/rewrite/pywikibot/data/api.py branches/rewrite/pywikibot/page.py
Modified: branches/rewrite/pywikibot/data/api.py =================================================================== --- branches/rewrite/pywikibot/data/api.py 2013-05-30 07:21:02 UTC (rev 11594) +++ branches/rewrite/pywikibot/data/api.py 2013-05-30 07:29:04 UTC (rev 11595) @@ -937,14 +937,14 @@ if 'revisions' in pagedict: for rev in pagedict['revisions']: revision = pywikibot.page.Revision( - revid=rev['revid'], - timestamp=rev['timestamp'], - user=rev.get('user', u''), - anon='anon' in rev, - comment=rev.get('comment', u''), - minor='minor' in rev, - text=rev.get('*', None) - ) + revid=rev['revid'], + timestamp=pywikibot.Timestamp.fromISOformat(rev['timestamp']), + user=rev.get('user', u''), + anon='anon' in rev, + comment=rev.get('comment', u''), + minor='minor' in rev, + text=rev.get('*', None) + ) page._revisions[revision.revid] = revision
if 'lastrevid' in pagedict:
Modified: branches/rewrite/pywikibot/page.py =================================================================== --- branches/rewrite/pywikibot/page.py 2013-05-30 07:21:02 UTC (rev 11594) +++ branches/rewrite/pywikibot/page.py 2013-05-30 07:29:04 UTC (rev 11595) @@ -395,7 +395,7 @@ return self._revisions[rev].anon
def editTime(self): - """Return timestamp (in ISO 8601 format) of last revision to page. + """Return timestamp of last revision to page.
""" rev = self.latestRevision() @@ -2180,8 +2180,8 @@ def contributions(self, total=500, namespaces=[]): """ Yield tuples describing this user edits with an upper bound of 'limit'. Each tuple is composed of a pywikibot.Page object, - the revision id (int), the edit timestamp (as int in mediawiki's - internal format), and the comment (unicode). + the revision id (int), the edit timestamp (as a pywikibot.Timestamp + object), and the comment (unicode). Pages returned are not guaranteed to be unique.
@param total: limit result to this number of pages @@ -2719,8 +2719,8 @@ @type revid: int @param text: Revision wikitext. @type text: unicode, or None if text not yet retrieved - @param timestamp: Revision time stamp (in ISO 8601 format) - @type timestamp: unicode + @param timestamp: Revision time stamp + @type timestamp: pywikibot.Timestamp @param user: user who edited this revision @type user: unicode @param anon: user is unregistered
pywikipedia-svn@lists.wikimedia.org