[Pywikipedia-l] SVN: [6617] branches/rewrite/pywikibot/data/api.py
russblau at svn.wikimedia.org
russblau at svn.wikimedia.org
Fri Apr 17 19:00:08 UTC 2009
Revision: 6617
Author: russblau
Date: 2009-04-17 19:00:08 +0000 (Fri, 17 Apr 2009)
Log Message:
-----------
This should fix session expiration bug (although we may have to wait a month to be sure)
Modified Paths:
--------------
branches/rewrite/pywikibot/data/api.py
Modified: branches/rewrite/pywikibot/data/api.py
===================================================================
--- branches/rewrite/pywikibot/data/api.py 2009-04-17 16:34:38 UTC (rev 6616)
+++ branches/rewrite/pywikibot/data/api.py 2009-04-17 19:00:08 UTC (rev 6617)
@@ -229,7 +229,11 @@
self.site._userinfo.update(result['query']['userinfo'])
else:
self.site._userinfo = result['query']['userinfo']
-
+ if self.site._userinfo['name'] != self.site.user():
+ # user is no longer logged in (session expired?)
+ self.site.login(self.site._username.index(self.site.user()))
+ # retry the previous query
+ continue
if "warnings" in result:
modules = [k for k in result["warnings"] if k != "info"]
for mod in modules:
More information about the Pywikipedia-l
mailing list