http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10955
Revision: 10955 Author: multichill Date: 2013-01-19 20:45:15 +0000 (Sat, 19 Jan 2013) Log Message: ----------- def logpages modified a bit to throw a BadTitle exception instead of just "Error". Should probably be expanded to throw proper exceptions for other problems.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2013-01-19 12:57:37 UTC (rev 10954) +++ trunk/pywikipedia/wikipedia.py 2013-01-19 20:45:15 UTC (rev 10955) @@ -6864,6 +6864,10 @@ nbresults = 0 while True: result = query.GetData(params, self) + if 'error' in result and result.get('error').get('code')==u'leparam_title': + output('%(info)s' % result.get('error')) + raise BadTitle + # FIXME: Throw proper exceptions instead of "Error" if 'error' in result or 'warnings' in result: output('%s' % result) raise Error