[Zope] Handling Session Timeouts

Chris McDonough chrism@zope.com
Wed, 5 Jun 2002 09:53:28 -0400


When you do a RESPONSE.redirect, the rest of the page is still rendered, and
it's not until the response is sent back to the browser that the redirect
happens.

The "missing" modifier to dtml var is useful here:

<dtml-var var1 missing>


----- Original Message -----
From: "Michael Fox" <Michael@Wodin.CenturySoftware.com.au>
To: <zope@zope.org>
Sent: Tuesday, June 04, 2002 8:57 PM
Subject: [Zope] Handling Session Timeouts


Hi *,

In an attempt to handle session timeouts, I'm wondering if someone on this
list can enlighten me.

My application utilises Zope's Transient Object Container & Session Data
Manager.

Once a user is authenticated, I set several variables in my Session Data
Manager with the values from a HTML form -

<dtml-call "REQUEST.SESSION.set('var1', var1 )">
<dtml-call "REQUEST.SESSION.set('var2', var2 )">
<dtml-call "REQUEST.SESSION.set('var3', var3 )">

Now these are variables are in my SDM, I set these in my
standard_html_header as such...

<dtml-call "REQUEST.set('var1',REQUEST.SESSION['var1'])">
<dtml-call "REQUEST.set('var2',REQUEST.SESSION['var2'])">
<dtml-call "REQUEST.set('var3',REQUEST.SESSION['var3'])">

This way I can access any session variables via <dtml-var var1> rather than
<dtml-var "REQUEST.SESSION['var1']">

Am I on the right track so far?

My problem is handling timeouts. My Trasient Object Container has a timeout
value of 20 mins.

In my attempt to handle timeouts, I have the following code in my
standard_html_header -

<dtml-if "REQUEST.SESSION.has_key('var1')">
  the session still has this key, therefore must be active, do nothing.
<dtml-else>
  <dtml-call "RESPONSE.redirect('login_page')">
</dtml-if>

* The rest of my HTML code goes here.

The problem is the redirect isn't working and Zope attempts to render the
page... thus resulting in a Zope error.

Does anyone have a working solution to this? or could point me in the
direction of some Docs/HOW-TO's?

Any help appreciated.

Regards,
Michael


_______________________________________________
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 )