[Zope] SESSION invalidate method

David H bluepaul at earthlink.net
Sun Apr 3 16:39:51 EDT 2005


Hi List,

I am curious about the SESSION.invalidate() method.

This code sets a SESSION key and value and then calls SESSION.invalidate():

<tal:block define="dummy 
python:request.SESSION.set('Dodgers','Baseball')" />

<p> before invalidate </p>
<p tal:content="python: request.SESSION" />

<tal:block define="dummy python:request.SESSION.invalidate()" />

<p> after invalidate()</p>
<p tal:content="python: request.SESSION" />

Produces this output:

before invalidate
id: 11125588150079827980, token: 95966850A1xaz-gQYlU, contents: 
[('Dodgers', 'Baseball')]

after invalidate()
id: 11125588150079827980, token: 95966850A1xaz-gQYlU, contents: 
[('Dodgers', 'Baseball')]

It seems that SESSION.invalidate() does not take immediate effect. 

Seems like a developer could getinto trouble if the same script *both* does
SESSION.invalidate()
SESSION.set('something','somevalue').

Because after the script runs 'something' goes away when invalidate() 
finally
occurs.

And is the effect described above to be expected or do I have this wrong?

Thanks,
David





More information about the Zope mailing list