[Pywikipedia-l] SVN: [5373] trunk/pywikipedia/wikipedia.py

nicdumz at svn.wikimedia.org nicdumz at svn.wikimedia.org
Wed May 14 17:13:32 UTC 2008


Revision: 5373
Author:   nicdumz
Date:     2008-05-14 17:13:31 +0000 (Wed, 14 May 2008)

Log Message:
-----------
Fixing a wikipedia.latestRevision() bug :

 >  page.latestRevision()
  File "/home/nico/projets/devpywiki/wikipedia.py", line 839, in latestRevision
    return int(self._permalink)
TypeError: int() argument must be a string or a number, not 'NoneType'

This was happenning when the page was not existing, because we were not raising _getexception when set by getall()

Modified Paths:
--------------
    trunk/pywikipedia/wikipedia.py

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2008-05-14 16:37:31 UTC (rev 5372)
+++ trunk/pywikipedia/wikipedia.py	2008-05-14 17:13:31 UTC (rev 5373)
@@ -836,6 +836,9 @@
             # When we get the page with getall, the permalink is received
             # automatically
             getall(self.site(),[self],force=True)
+            # Check for exceptions
+            if hasattr(self, '_getexception'):
+                raise self._getexception
         return int(self._permalink)
 
     def previousRevision(self):





More information about the Pywikipedia-l mailing list