quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory (Grisha) Trubetskoy" <gri...@apache.org>
Subject Re: Session timeout problem
Date Tue, 19 Aug 2003 14:27:22 GMT

Yes, I think adding a self.clear() after self.do_delete() (line 240) would
do it.

P.S. I'm still trying to figure out the graceful restart problem.

Grisha

On Sun, 17 Aug 2003, Barry Pederson wrote:

> This is an easy one...
>
> In the snapshot http://www.modpython.org/tmp/httpd-python-20030814.tgz
> the BaseSession.__init__() method checks for a session timing out, and
> if it's expired, it makes a new session.  However, the old session's
> data is still hanging around and is carried over into the new session.
>
> There probably should be a call to self.clear() somewhere in there,
> perhaps at the end of Session.delete()?
>
> Here's a bit of demo code.  Every time you reload the page, the count
> stored in the session increases by one, even if you wait longer than 30
> seconds and have a new session created.
>
> ----------------
> import time
> from mod_python.Session import Session
>
> def index(req):
>      sess = Session(req)
>      count = sess.get('count', 0) + 1
>      sess['count'] = count
>      sess.set_timeout(30)
>      sess.save()
>      return 'is_new(): %d count: %d, time: %s' % (sess.is_new(), count,
> time.strftime('%Y-%m-%d %H:%M:%S'))
> -----------------
>
> 	Barry
>

Mime
View raw message