cookie can be retrieved from request like:

self.request.cookies.get('sid')

On Oct 4, 10:36 am, Allen <[email protected]> wrote:
> And how can i retrieve the Cookie?
>
> I try in this way:
>
>     cookie = Cookie.SimpleCookie()
>     strsid = os.environ.get('HTTP_COOKIE')
>     if strsid:
>          cookie.load(strsid)
>         sid = cookie['sid'].value
>
> is it correct?
>
> Thanks a lot!
>
> On Oct 4, 10:28 am, Allen <[email protected]> wrote:
>
> > Hi Tobias,
>
> > Should I:
> > ....
>
> > h = re.compile('^Set-Cookie: ').sub('', cookie.output(), count=1)
> > self.response.headers.add_header('Set-Cookie', str(h))
> > self.response.out.write(htmlcode)
>
> > I try, but seems doesn't works.
>
> > Allen
>
> > On Oct 4, 7:34 am, Tobias <[email protected]> wrote:
>
> > > Hi Allen,
>
> > > On Oct 3, 12:28 pm, Allen <[email protected]> wrote:
>
> > > > I try as follow to create a Cookie.
>
> > > > 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))
>
> > > Hope it helps,
> > > Tobias- Hide quoted text -
>
> > - Show quoted text -
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to