Revision: 5531 Author: btongminh Date: 2008-06-08 16:47:09 +0000 (Sun, 08 Jun 2008)
Log Message: ----------- Fix some None exceptions
Modified Paths: -------------- trunk/pywikipedia/commonsdelinker/image_replacer.py
Modified: trunk/pywikipedia/commonsdelinker/image_replacer.py =================================================================== --- trunk/pywikipedia/commonsdelinker/image_replacer.py 2008-06-08 15:35:32 UTC (rev 5530) +++ trunk/pywikipedia/commonsdelinker/image_replacer.py 2008-06-08 16:47:09 UTC (rev 5531) @@ -133,9 +133,11 @@ ('rvprop', 'timestamp|user|comment|content'), ('rvlimit', '50'), ('format', 'json'), - ('rvend', since), - ('rvexcludeuser', username.encode('utf-8')) ] + if username: + predata.append(('rvexcludeuser', username.encode('utf-8')) + if since: + predata.append(('rvend', since)) response, data = self.site.postForm(address, predata) data = simplejson.loads(data) if 'error' in data: @@ -144,7 +146,7 @@ page = data['query']['pages'].values()[0] if 'missing' in page: raise Exception('Missing page!') - return page.get('revisions', ()) + return page.get('revisions', []) def examine_revision_history(self, revisions, replacement, username): for revision in revisions:
pywikipedia-l@lists.wikimedia.org