http://www.mediawiki.org/wiki/Special:Code/pywikipedia/8980
Revision: 8980 Author: valhallasw Date: 2011-02-17 23:45:06 +0000 (Thu, 17 Feb 2011) Log Message: ----------- Follow-up for r8979: check for None values in username/_userinfo (PYWP-16)
If no (sysop/user) username is defined, self.username[False/True] will be None. This will trigger an Exception in the constructor for the Page (and following Link) objects. This is now fixed.
Modified Paths: -------------- branches/rewrite/pywikibot/site.py
Modified: branches/rewrite/pywikibot/site.py =================================================================== --- branches/rewrite/pywikibot/site.py 2011-02-17 21:58:21 UTC (rev 8979) +++ branches/rewrite/pywikibot/site.py 2011-02-17 23:45:06 UTC (rev 8980) @@ -678,7 +678,9 @@ @param sysop: if True, require sysop privileges.
""" - if pywikibot.Page(self, ns=2, title=self.userinfo['name']) != \ + if self.userinfo['name'] is None or\ + self._username[sysop] is None or\ + pywikibot.Page(self, ns=2, title=self.userinfo['name']) != \ pywikibot.Page(self, ns=2, title=self._username[sysop]): return False return (not sysop) or 'sysop' in self.userinfo['groups']
pywikipedia-svn@lists.wikimedia.org