It seems work while test by dev_appserver.py
but when I upload it to GAE. I always need to re-login in about 1
minute.
whether the cookie expired in 1 minute? how can I do?
Thanks
Following is my code:
#create new cookie while login and response for user request:
new_sid = sha.new(repr(time.time())).hexdigest()
cookie = Cookie.SimpleCookie()
cookie['sid'] = new_sid
cookie['sid']['expires'] = 24*60*60
h = re.compile('^Set-Cookie: ').sub('', cookie.output(), count=1)
......
self.response.headers.add_header('Set-Cookie', str(h))
self.response.out.write(webdata)
#retrieve the cookie while user make new request, and response again
for new page:
sid = self.request.cookies.get('sid')
cookie['sid'] = sid
cookie['sid']['expires'] = 24*60*60
h = re.compile('^Set-Cookie: ').sub('', cookie.output(), count=1)
......
self.response.headers.add_header('Set-Cookie', str(h))
self.response.out.write(webdata)
##################################
On Oct 4, 3:29 am, Anh Hai Trinh <[email protected]> wrote:
> > NEW_SID =
> > sha.new(repr(time.time())).hexdigest()cookie=Cookie.SimpleCookie()cookie['s
> > id'] = NEW_SIDcookie['sid']['expires'] = 24*60*60
>
> I believe you can do
>
>
>
> > self.response.out.write(cookie.output())
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---