I probably wanted this instead:
## set
response.set_cookie('sitelang', 'uk', expires=3600) # Pylons 0.9.6
syntax.
response.set_cookie('sitelang', 'uk', max_age=3600) # Pylons 0.9.7
syntax.
## get
lang = request.cookies['sitelang']
from here:
http://wiki.pylonshq.com/display/pylonscookbook/Setting+cookies+and+response+headers
Edgar
On Apr 7, 1:52 pm, Thorsten Lockert <[email protected]> wrote:
> On Apr 7, 2009, at 10:36 , Ben Bangert wrote:
>
>
>
> > On Apr 7, 2009, at 5:52 AM, edgarsmolow wrote:
>
> >>http://pylonshq.com/docs/en/0.9.7/sessions/#id2
>
> >> but did not see a reference to these fields (you mentioned):
>
> >> session['_id']
> >> session['_accessed_time']
> >> session['_creation_time']
>
> >> I suppose I still don't understand the problem. If the cookie
> >> exists,
> >> when the browser is first directed to a URL, why can Beaker (or
> >> whichever component is involved) read the cookie? If it had read the
> >> cookie, session['some_var'] would be available.
>
> > I'm not sure I understand what you're talking about either. The code
> > sample you originally included could be translated like so:
>
> > If there's a cookie already present:
> > do something with it
> > otherwise, when no cookie is around:
> > do something else
>
> > On the first visit to the web page, of course there isn't a cookie
> > YET, its the first visit after all. So the second if statement runs.
> > On the second visit, since they've been there before, there's a
> > cookie present, so the first if statement runs. This seems obvious
> > enough, I'm not sure where the confusion is?
>
> I think perhaps what he is expecting is a persistent cookie -- which
> is not what sessions and session cookies are all about?
>
> Thorsten
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---