Ben, I've looked at this documentation,
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. Edgar On Apr 6, 11:37 pm, Ben Bangert <[email protected]> wrote: > On Apr 6, 2009, at 6:39 AM, edgarsmolow wrote: > > > if 'session-id' in session: > > ## do something > > else: > > session['session_id'] = some_session_id > > session.save() > > ## do other stuff > > > When first coming to a web page, a new cookie is *always* being > > created because the IF test *always* fails because the session id is > > not found. I was hoping that it would be found; that way, previously > > entered data can be recouped. > > > Perhaps I am just not understanding the cookie mechanism. > > I think that is part of the problem. Why would the session have data > for a key that hasn't been set yet? There is only one key that exists > by default in a brand new cookie-based session, and that is the > session['_id'] field, also accessible as session.id. Nothing else will > be found in a new session, so the behavior you report is the correct > behavior. > > Once you have saved the cookie-based session, two other attributes are > added, session['_accessed_time'] and session['_creation_time'], since > the session needs to have existed for those to be set. > > Why would you expect it to have previous data if its the first time > the user has ever come to the site? > > Cheers, > Ben > > smime.p7s > 3KViewDownload --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
