[Zope] session invalidate - using python

Chris McDonough chrism@zope.com
Wed, 30 Oct 2002 16:53:38 -0500


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.


----- Original Message -----
From: "p.t." <p.training@tin.it>
To: "'Zope@Zope. Org' (E-mail)" <zope@zope.org>
Sent: Wednesday, October 30, 2002 4:22 PM
Subject: [Zope] session invalidate - using python


> Using this simple script, I expected that a None should be
returned
> (according to
>
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/Sessions
.stx):
>
> data = context.session_data_manager.getSessionData( create=0 )
> data.invalidate()
> return str( data )    # str() just to see None
>
> But a result like this is allways returned:
>
> id: 10360120480192202025, token: 54001646A0iEAi2X9io, contents: []
>
> with id change at each call (token is the same because the browser
is the
> same).
> A new session is ceated at each hit (refresh) in the same browser:
and the
> counter in the transient object container is increased
accordingly.
> I did put Data object timeout value in minutes = 1, but after 30
minuts a
> new hit increase the counter.
>
> Does create=0 work properly?
> Does invalidate() work at all?
> What am I doing wrong?
>
> Thanks for help.
> p.t.
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>