Revision: 5666 Author: filnik Date: 2008-07-03 19:18:50 +0000 (Thu, 03 Jul 2008)
Log Message: ----------- Little fix IndexError -> KeyError for getLatestUploader()
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-07-03 09:36:23 UTC (rev 5665) +++ trunk/pywikipedia/wikipedia.py 2008-07-03 19:18:50 UTC (rev 5666) @@ -2634,7 +2634,7 @@ nick = data['query']['pages'][pageid][u'imageinfo'][0][u'user'] timestamp = data['query']['pages'][pageid][u'imageinfo'][0][u'timestamp'] return [nick, timestamp] - except IndexError: + except KeyError: raise NoPage(u'API Error, nothing found in the APIs')
def getHash(self): @@ -2653,7 +2653,7 @@ pageid = data['query']['pages'].keys()[0] try: hash_found = data['query']['pages'][pageid][u'imageinfo'][0][u'sha1'] - except KeyError: + except (KeyError, IndexError): if self.exists(): raise NoHash('No Hash found in the APIs! Maybe the regex to catch it is wrong or someone has changed the APIs structure.') else:
pywikipedia-l@lists.wikimedia.org