John Mudd
mudd at vex.net
Tue Apr 6 06:29:47 EST 2004
Yes, that's what I'm thinking. It doesn't mean you can save the session later also. You just need to get the cookie saved correctly once at the start. On Tue, 2004-04-06 at 06:25, Richard Barrett wrote: > On 6 Apr 2004, at 11:02, John Mudd wrote: > > > 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. > > > > Could that be because the cookie has to go in the response header and > starting to write the response body "flushes" the response headers in > whatever state they are in at that point, as they must precede the > body, and thus any subsequent header changes are in effect lost? > > > 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 > > > > _______________________________________________ > > Mod_python mailing list > > Mod_python at modpython.org > > http://mailman.modpython.org/mailman/listinfo/mod_python > >
|