Revision: 7966 Author: erwin85 Date: 2010-02-26 09:20:14 +0000 (Fri, 26 Feb 2010)
Log Message: ----------- Fallback for checking blocks on private wikis; Otherwise login.py fails.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2010-02-26 04:57:12 UTC (rev 7965) +++ trunk/pywikipedia/wikipedia.py 2010-02-26 09:20:14 UTC (rev 7966) @@ -4828,10 +4828,13 @@ 'meta': 'userinfo', 'uiprop': 'blockinfo', } + data = query.GetData(params, self) + if not data or 'error' in data: + return False if self.versionnumber() == 11: # fix for version 1.11 API. - data = query.GetData(params, self)['userinfo'] + data = data['userinfo'] else: - data = query.GetData(params, self)['query']['userinfo'] + data = data['query']['userinfo'] return 'blockedby' in data except NotImplementedError: return False
pywikipedia-svn@lists.wikimedia.org