http://www.mediawiki.org/wiki/Special:Code/pywikipedia/8979
Revision: 8979 Author: valhallasw Date: 2011-02-17 21:58:21 +0000 (Thu, 17 Feb 2011) Log Message: ----------- Use Page objects to check for user name equality (PYWP-15)
The Site object checks whether the is logged in by checking equality of user names. When the first-letter capitalization is not equal, this caused the bot to relogin. The check now uses Page objects, so site-specific capitalization conventions are used.
Modified Paths: -------------- branches/rewrite/pywikibot/site.py
Modified: branches/rewrite/pywikibot/site.py =================================================================== --- branches/rewrite/pywikibot/site.py 2011-02-17 21:05:08 UTC (rev 8978) +++ branches/rewrite/pywikibot/site.py 2011-02-17 21:58:21 UTC (rev 8979) @@ -678,7 +678,8 @@ @param sysop: if True, require sysop privileges.
""" - if self.userinfo['name'] != self._username[sysop]: + if 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