Last modified: 2014-10-20 12:36:28 UTC
My user-config.py contains: usernames['wiktionary']['en'] = u'MewBot' sysopnames['wiktionary']['en'] = u'CodeCat' So when I perform an action that requires sysop access, it should switch to another account, and indeed it does. It asks me to log in to the sysop account. But once logged in, and then attempting to delete a page, the following occurs: Traceback (most recent call last): File "Desktop/bot/deleteempty.py", line 13, in <module> current.delete(reason="Empty category; recreate when needed", prompt=False) File "(redacted)/pywikibot/pywikibot/tools.py", line 529, in wrapper return obj(*__args, **__kw) File "(redacted)/pywikibot/pywikibot/page.py", line 1489, in delete return self.site.deletepage(self, reason) File "(redacted)/pywikibot/pywikibot/site.py", line 932, in callee return fn(self, *args, **kwargs) File "(redacted)/pywikibot/pywikibot/site.py", line 4033, in deletepage token = self.tokens['delete'] File "(redacted)/pywikibot/pywikibot/site.py", line 1279, in __getitem__ assert(self.site.logged_in()) AssertionError <type 'exceptions.AssertionError'> I inserted some test code into site.py to see why the assertion is failing. And curiously, self.site.logged_in() returns False, but self.site.logged_in(sysop=True) returns True. Tracking it down further to the logged_in method, it appears that the condition if self.userinfo['name'] != self._username[sysop]: return False is what is returning False. Inserting a test to display the two values being compared, it turns out that self.userinfo['name'] is the sysop user name, but self._username[sysop] is the regular user name. This is not terribly surprising as sysop is False in this case.
Change 167452 had a related patch set uploaded by XZise: [FIX] TokenWallet: Assert a username https://gerrit.wikimedia.org/r/167452
Change 167452 merged by jenkins-bot: [FIX] TokenWallet: Assert a username https://gerrit.wikimedia.org/r/167452
The problem is still occurring, but now in a different piece of code. File "Desktop/bot/deleteempty.py", line 13, in <module> current.delete(reason="Empty category; recreate when needed", prompt=False) File "(redacted)/pywikibot/pywikibot/tools.py", line 529, in wrapper return obj(*__args, **__kw) File "(redacted)/pywikibot/pywikibot/page.py", line 1489, in delete return self.site.deletepage(self, reason) File "(redacted)/pywikibot/pywikibot/site.py", line 932, in callee return fn(self, *args, **kwargs) File "(redacted)/pywikibot/pywikibot/site.py", line 4033, in deletepage token = self.tokens['delete'] File "(redacted)/pywikibot/pywikibot/site.py", line 1294, in __getitem__ self.load_tokens([key], all=False if user_tokens else None) File "(redacted)/pywikibot/pywikibot/site.py", line 1264, in load_tokens assert(self.site.logged_in())