http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11186

Revision: 11186
Author:   legoktm
Date:     2013-03-07 05:28:54 +0000 (Thu, 07 Mar 2013)
Log Message:
-----------
Store the revision id, and override Page.latestRevision

Modified Paths:
--------------
    branches/rewrite/pywikibot/page.py

Modified: branches/rewrite/pywikibot/page.py
===================================================================
--- branches/rewrite/pywikibot/page.py  2013-03-07 04:45:47 UTC (rev 11185)
+++ branches/rewrite/pywikibot/page.py  2013-03-07 05:28:54 UTC (rev 11186)
@@ -2238,7 +2238,8 @@
                 raise pywikibot.data.api.APIError, data['errors']
             self.id = data['entities'].keys()[0]
             self._content = data['entities'][self.id]
-            #aliases
+            self.lastrevid = self._content['lastrevid']
+        #aliases
         self.aliases = {}
         if 'aliases' in self._content:
             for lang in self._content['aliases']:
@@ -2263,8 +2264,11 @@
                 'descriptions':self.descriptions,
                 }
 
+    def latestRevision(self):
+        if not hasattr(self, 'lastrevid'):
+            self.get()
+        return self.lastrevid
 
-
     def save(self, summary, **kwargs):
         """
         Save whatever we added/removed/etc.
@@ -2367,6 +2371,7 @@
         """
         raise NotImplementedError
 
+
 class QueryPage(WikibasePage):
     """
     For future usage, not implemented yet


_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn

Reply via email to