[Zope] Handling Session Timeouts

Michael Fox Michael@Wodin.CenturySoftware.com.au
Wed, 5 Jun 2002 10:57:26 +1000


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