[mod_python] Sessions function curiously in Internet Explorer

Jim Gallacher jg.lists at sympatico.ca
Sat Oct 1 09:53:49 EDT 2005


The code below works fine for me with IE 6.0 using Crossover office. 
(Actually I made one small change to explicitly set req.content_type = 
'text/plain').

As an aside you don't need to call sess.load(). load() is automatically 
called when you create the session object if valid session data exists.

Jim

Paul Hide wrote:
> The code below behaves differently in FireFox and Internet Explorer, is 
> that because there is something wrong with the code? Or is it just IE?
> 
> Versions are Apache 2.0.54, mod_python 3.1.3 running on win 2k, but the 
> same is true when pages are served from Debian Sarge Box with slightly 
> different versions of the server and module.
> 
> Paul Hide
> 
> #FireFox 1.07 counter increments each time you click go
> #IntExp 5.5 & 6 counter never gets beyon 2 unless you delete the cache 
> between clicks
> 
> from mod_python import Session
> 
> def test(req):
>         sess = Session.Session(req)
>         if sess.is_new():
>             sess.set_timeout(100)
>             sess['myvar'] = 1
>             req.write('new ')
>             req.write(sess.id())
>             #if you dont save it, it is new every time
>             sess.save()
>         else:
>             sess.load()
>             sess['myvar'] = sess['myvar'] + 1
>             req.write(str(sess['myvar']))
>             sess.save()
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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