I would just add a key/value pair to the session data object at some opportune point in the user's experience with your site. If it doesn't exist, the session data object is new or an old one has been expired. - C ----- Original Message ----- From: "p.t." <p.training@tin.it> To: "Chris McDonough" <chrism@zope.com>; "'Zope@Zope. Org' (E-mail)" <zope@zope.org> Sent: Wednesday, October 30, 2002 5:26 PM Subject: Re: [Zope] session invalidate - using python
Chris, thanks for the very clear explanation. In effect, I was trying to undestand how session expiring works, because I'm looking for a way to detect when a request coming from a browser associated to a session find the session expired. Have you a suggestion? TIA, p.t.
At 16:53 30/10/2002 -0500, Chris McDonough wrote:
No. By doing data.invalidate(), you've invalidated the data object (which means it will eventually be removed from the session data container), but that won't magically turn it in to the None object.
It makes sense that on each call you're getting a new data object as you're invalidating the old one.
getSessionData returns a session data object associated with the current browser id. The "create=0" argument doesn't mean "dont create a session data object", it means "don't create a session data object unless there is a current browser id". Since there is a current browser id, a session data object is returned instead of None.