[mod_python] Session example and problems.

Graham Dumpleton grahamd at dscpl.com.au
Thu Feb 24 16:22:24 EST 2005


>From documentation:

  save()
    This method writes session values to storage.

I am sure someone will post yet another example, but there has been
heaps of discussion about sessions before on the mailing list. You might
therefore go to www.modpython.org and plug:

  session save inurl:pipermail

into the search box. Doing this you may well find lots of other stuff as
well to answer questions you don't yet have.

Graham


donnie jones wrote ..
> Hello,
> 
> Could someone please give me an example of using the Session() 
> in modpython for passing data between functions?  
> I have been googling, but with no success..
> 
> The problem I am having is that each time I reload a page that calls
> the function like below, it creates a new session.
> 
> def test(req):
>   sess = Sess(req);
>   sid = sess.id();
>   if sess.is_new():
>     req.write("new session %s" % sid);
>   else:
>     sess.load();
>     req.write("%s" % sess['username']);
> 
> I am printing the session id and each time the function is loaded
> I get a new session id, thus I cannot store data in the session
> to use in other functions...
> 
> 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