http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11205
Revision: 11205
Author: legoktm
Date: 2013-03-14 16:20:15 +0000 (Thu, 14 Mar 2013)
Log Message:
-----------
If the item does not exist, it will not have a lastrevid
so we should throw a NoPage error, rather than a general
KeyError.
Modified Paths:
--------------
branches/rewrite/pywikibot/page.py
Modified: branches/rewrite/pywikibot/page.py
===================================================================
--- branches/rewrite/pywikibot/page.py 2013-03-12 15:19:55 UTC (rev 11204)
+++ branches/rewrite/pywikibot/page.py 2013-03-14 16:20:15 UTC (rev 11205)
@@ -2230,7 +2230,10 @@
data = self.repo.loadcontent(self.__defined_by(), *args)
self.id = data.keys()[0]
self._content = data[self.id]
- self.lastrevid = self._content['lastrevid']
+ if 'lastrevid' in self._content:
+ self.lastrevid = self._content['lastrevid']
+ else:
+ raise pywikibot.NoPage
#aliases
self.aliases = {}
if 'aliases' in self._content:
_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn