Hi Jonathan, I'm sure that what you said is right but 1) I tried to change my script performing a manage_add that should be performed after timeout. Nothing happened. 2) However the only way I see is: a- keep the session id in the request b- if request.savedsessionid<>session.id then alert "session timed out" thank you for your help ---------- Initial Header -----------
From : "Jonathan" dev101@magma.ca To : jbusato@libero.it,"zope" zope@zope.org Cc : Date : Sat, 28 Jul 2007 08:17:08 -0400 Subject : Re: [Zope] TOC ondelete event
----- Original Message ----- From: <jbusato@libero.it> To: "zope" <zope@zope.org> Sent: Saturday, July 28, 2007 7:15 AM Subject: [Zope] TOC ondelete event
I'm setting up a Session data Manager with a Transient Object Container that call a python script session_delete? (sdo,toc).
I want to show a message like ("your session was terminated due inactivity") so I tried to write this
#PYTHON SCRIPT (NOT EXTERNAL) session_delete(sdo,toc) request = container.REQUEST RESPONSE = request.RESPONSE RESPONSE.redirect(container.mywarningpage.absolute_url())
Launched manually it gives me no errors but when the session is terminated only "onadd" script make effects.
Are there not permitted operations in this case? Could anyone explain me where I mistake or another way to do tha same thing? (AFAIK sdo parameter is the old session so I can't store any info in it)
The TOC invokes your script when the "data object timeout value" is reached (eg. if the timeout value is set for 5 minutes, then the TOC will invoke the "script to call when objects are deleted" when there has been no activity for 5 minutes).
The TOC invokes the delete script as a result of the timeout, not because of an incoming user request and therefore there is no user to be 'redirected'. You are trying to push out a message to a user that is no longer "there".
You need to revise your application logic so that if a user comes back (makes another request) after the 'timeout' they receive your warning message.
hth
Jonathan
------------------------------------------------------ Scegli infostrada: ADSL gratis per tutta lestate e telefoni senza canone Telecom http://click.libero.it/infostrada