[Zope] Handling Session Timeouts

Michael Fox Michael@Wodin.CenturySoftware.com.au
Thu, 6 Jun 2002 15:38:02 +1000


Thanks Chris, this is exactly what I needed.

Cheers,
Michael

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Chris
McDonough
Sent: Thursday, 6 June 2002 12:40 AM
To: hans
Cc: Michael Fox; zope@zope.org
Subject: Re: [Zope] Handling Session Timeouts


There is also a modifier to RESPONSE.redirect named "lock" that locks
the status code to 302 and disallows any errors to change the status
code.  This is also a reasonable way of avoiding this problem.

RESPONSE.redirect('some/page', lock=3D1)
=20
On Wed, 2002-06-05 at 10:55, hans wrote:
> Chris McDonough wrote:
>=20
> > 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>
> >
>=20
> http://www.zope.org/Members/datagrok/WatchThatRedirection
> or put <dtml-return> after redirect
>=20
> > * 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
>=20




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