wxPython & Cookie
[email protected] Tue, 17 Apr 2018 19:38:38 -0700 (PDT)
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi there, I am struggling with creating a cookie out to disk. Using Win 10, wxPython 3.0.2, a python program sets a cookie with expires date iduring the initial load of MainFrame and print the result on command screen. Cookie information are shown on the command screen, however the cookie was not stored in disk (supposed to be in internet temporary folder?) I don't know what I missed. I verified that Win 10 allows any sort of cookie. I originally planned to create a cookie when all data entered are valid and ready to move on to next program, I wanted to create a cookie and at the same time setup sessions info to pass on to next program. This plan did not create a cookie on to disk either, so I changed to create a cookie before the initial form is displayed. I will attach the source of initial load part. Will appreciate any advice. Noby -- You received this message because you are subscribed to the Google Groups "wxPython-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
mainframe.py
(text/x-python, 862 B)
class MyFrame(sy0000f.MainFrame):
def __init__( self, parent ):
sy0000f.MainFrame.__init__( self, parent )
print "sy0000 init "
# establish cookie object
self.a_cookie = Cookie.SimpleCookie()
print self.a_cookie
# establish session object
self.clsSession = Session_Class()
print "cookie id =" + COOKIE_ID
if COOKIE_ID in os.environ:
cookie_string = os.environ.get(COOKIE_ID)
self.a_cookie.load(cookie_string)
print self.a_cookie
strSessionID = self.a_cookie[COOKIE_ID].value
print self.a_cookie
else:
strSessionID = self.clsSession.createNewSession()
print "session name = " + strSessionID
self.a_cookie[COOKIE_ID] = strSessionID
datExpires = datetime.datetime.now()+datetime.timedelta(days=+10)
self.a_cookie[COOKIE_ID]["expires"] = datExpires.strftime("%a, %d-%b-%Y %H:%M:%S GMT")
print self.a_cookie
mainframe.xls
(application/vnd.ms-excel, 70.5 KB) - not displayed