|
donnie jones
donniejones18 at gmail.com
Fri Apr 1 13:14:34 EST 2005
Hello,
I am using modpython and my html uses an XMLHttpRequest from
javascript to call to the python script with the req publisher to load
the html into a particular part of the page.
But I am having problems because my session never gets the
sess.last_accessed updated
and it always timeouts(expires the session). I am not sure why this
is happening...
Example code:
#######################
def testFunction(req, sid=""):
sess = Session(req, sid, None, 30);
if sess.is_new():
req.write("""<p>Session expired, please \
<a href="login.html">click here to relogin.</a></p>""");
else:
sess.load();
u=sess['u'];
p=sess['p'];
sess.save();
req.write("Welcome user: %s" %u);
req.write("cookie: %s<br/>" % Cookie.get_cookies(req)['pysid']);
req.write("sid: %s<br/>" % sess.id());
req.write("last: %s<br/>" % sess.last_accessed());
########################
I intentionally have a very short timeout period of 30 seconds to make
testing easier...
The sid defaults to sid="" from the function call since I am not
passing the sid.
Each time I print out the sid and the pysid from the cookie they match, but as
mentioned last_accessed() never changes.
Any help would be grealy appreciated.
Thank you.
__
Donnie
|