[mod_python] session example

John Mudd mudd at vex.net
Tue Apr 6 06:02:02 EST 2004


I may be way off so feel free to correct me but here what I've come to
believe.  It's necessary to write cookies before any other writes.  So
you need to save the session (which writes it's cookie) before any other
writes.

John


On Tue, 2004-04-06 at 04:13, pascalbarbedor at free.fr wrote:
> hi 
> thanks for preceeding answer but I cant make it work.
> 
> what's wrong with this:
> ---------------------------------------
> sess=Session.Session(req)
> 
> if sess.is_new():
>     req.write(sess.id())
> else :
>     req.write('used session %s'%sess.id())
> 
> sess['login']='toto'
> 
> req.write("%s"%sess)
> 
> sess.save()
> ----------------------------------------
> 
> shouldn't it display session used on second reload of the page ?
> 
> 
> thanks
> _______________________________________________
> 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