Revision: 8071
Author:   xqt
Date:     2010-04-09 16:41:08 +0000 (Fri, 09 Apr 2010)

Log Message:
-----------
(Q&D) bugfix for #2983182 (unable to login after bugzilla fix 23076). Sorry for 
this hack, maybe a cleaner version is coming soon.

Modified Paths:
--------------
    trunk/pywikipedia/login.py

Modified: trunk/pywikipedia/login.py
===================================================================
--- trunk/pywikipedia/login.py  2010-04-09 14:49:40 UTC (rev 8070)
+++ trunk/pywikipedia/login.py  2010-04-09 16:41:08 UTC (rev 8071)
@@ -172,6 +172,28 @@
                 result = data['login']['result']
                 if result == "NeedToken":
                     predata["lgtoken"] = data["login"]["token"]
+                    # build the cookie (q&d-fix)
+                    ####
+                    Reat=re.compile(': (.*?)=(.*?);')
+                    L = {}
+                    L["cookieprefix"] = "pdcwiki"
+                    #print '---------# data #---------'
+                    #print data
+                    #if got_token and got_user:
+                    #process the basic information to Site()
+                    index = self.site._userIndex(self.sysop)
+                    #print index
+                    #API result came back username, token and sessions.
+                    if ['lgtoken'] in data['login'].keys():
+                        self.site._userName[index] = 
data['login']['lgusername']
+                        self.site._token[index] = data['login']['lgtoken'] + 
"+\\"
+                    if self.site._cookies[index]:
+                        #if user is trying re-login, update the new information
+                        self.site.updateCookies(L, self.sysop)
+                    else:
+                        # clean type login, setup the new cookies files.
+                        self.site._setupCookies(L, self.sysop)
+                    ####
                     continue
                 break
             if result != "Success":



_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn

Reply via email to