Re: [Zope] TOC ondelete event

2007-07-30 Thread Chris Withers

[EMAIL PROTECTED] wrote:

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"


This won't work as you expect.
Specifically, request.savedsessionid will never be there when you want 
it, since a request is just that; a single http request to Zope. The 
next time the user shows up, it will be a different request object...


cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] TOC ondelete event

2007-07-28 Thread Jonathan


- Original Message - 
From: <[EMAIL PROTECTED]>

To: "dev101" <[EMAIL PROTECTED]>
Cc: "zope" 
Sent: Saturday, July 28, 2007 8:51 AM
Subject: Re: [Zope] TOC ondelete event



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.


My guess is that there is a bug in your timeout script. Debugging scripts 
that get invoked on TOC timeout can be tricky.  I put my timeout routines in 
external methods so that I can easily write out debug info to a log file.




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"


If i understand correctly, what you are trying to accomplish is:

1- user starts a session and then has x minutes of inactivity
2- at x + 1 minutes the session timesout
3- at x+2 (or later) minutes the user restarts the session and you want to 
display a warning/timed-out message


If this is the case, then one possible solution (and there is always more 
than one solution!) is to store the session id in a cookie on the user's pc, 
then you could test: if cookieSessionId != session.id...



Jonathan

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] TOC ondelete event

2007-07-28 Thread [EMAIL PROTECTED]
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" [EMAIL PROTECTED]
To  : [EMAIL PROTECTED],"zope" zope@zope.org
Cc  :
Date  : Sat, 28 Jul 2007 08:17:08 -0400
Subject : Re: [Zope] TOC ondelete event







>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: "zope" 
> 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 lÂ’estate e telefoni senza canone 
Telecom
http://click.libero.it/infostrada

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] TOC ondelete event

2007-07-28 Thread Jonathan


- Original Message - 
From: <[EMAIL PROTECTED]>

To: "zope" 
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


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] TOC ondelete event

2007-07-28 Thread [EMAIL PROTECTED]
Hi,

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)

Thank you so much

Jary Busato


--
Scegli infostrada: ADSL gratis per tutta lÂ’estate e telefoni senza canone 
Telecom
http://click.libero.it/infostrada

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )