Revision: 5067 Author: russblau Date: 2008-02-21 19:43:55 +0000 (Thu, 21 Feb 2008)
Log Message: ----------- Catch NotImplementedError from sites that don't support api.php
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-02-21 19:42:30 UTC (rev 5066) +++ trunk/pywikipedia/wikipedia.py 2008-02-21 19:43:55 UTC (rev 5067) @@ -3826,8 +3826,12 @@
def isBlocked(self, sysop = False): """Check if the user is blocked.""" - text = self.getUrl(u'%saction=query&meta=userinfo&uiprop=blockinfo' % self.api_address(), sysop = sysop) - return text.find('blockedby=') > -1 + try: + text = self.getUrl(u'%saction=query&meta=userinfo&uiprop=blockinfo' + % self.api_address(), sysop=sysop) + return text.find('blockedby=') > -1 + except NotImplementedError: + return False
def isAllowed(self, right, sysop = False): """Check if the user has a specific right.
pywikipedia-l@lists.wikimedia.org