https://bugzilla.wikimedia.org/show_bug.cgi?id=72238
Bug ID: 72238
Summary: site.logged_in() returns False when logged in to sysop
account
Product: Pywikibot
Version: core (2.0)
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: Unprioritized
Component: General
Assignee: Pywikipedia-bugs(a)lists.wikimedia.org
Reporter: codecat42(a)gmail.com
Web browser: ---
Mobile Platform: ---
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.
--
You are receiving this mail because:
You are the assignee for the bug.