[mod_python] Re: Session always timeouts using XMLHttpRequest.

Nicolas Lehuen nicolas.lehuen at gmail.com
Tue Apr 5 09:09:05 EDT 2005


Are you sure your client-side XMLHttpRequest object correctly handles
cookies and send them to the server ? If not, then you're out of luck.
You could try passing the session id as an URL parameter, though. In
any case, this is a client-side problem, not one in mod_python.

Regards,

Nicolas

On Apr 5, 2005 2:55 PM, donnie jones <donniejones18 at gmail.com> wrote:
> 
> Any ideas of things to try to fix this problem?
> Thank you.
> __
> Donnie
> 
> 
> On Fri, 1 Apr 2005 13:14:34 -0500, donnie jones <donniejones18 at gmail.com> wrote:
> > 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
> >
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list