[mod_python] Re: DbmSession

Jim Gallacher jpg at jgassociates.ca
Sat Apr 29 11:56:15 EDT 2006


Any chance you were doing a req.write call *before* creating the session 
instance? The first req.write() causes the response headers to be sent, 
so if Session.Session() comes later in your code it will not be able to 
set the cookie. (Actually, it will set it, but the headers have already 
been sent, so it is effectively a noop).

Jim

Stefan Glaus wrote:
>> From what I understand (This very well could be wrong), session.save()
> does the save to the dbm file, and doesn't really have anything to do
> with the cookies.
> 
> Thanks!
> 
> On 4/28/06, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
>> I hope you are doing a session.save() somewhere. You don't show
>> it in your code and without it, you will get a new session
>> every time.
>>
>> Graham
>>
>> On 29/04/2006, at 12:35 AM, Stefan Glaus wrote:
>>
>> > The relevant code is as follows:
>> >
>> > session = Session.Session(req)
>> > if session.is_new():
>> >       req.write("new")
>> >
>> > req.write(session.id() + '<BR><BR>')
>> >
>> >
>> > I'm running this on apache 2.0 with python 2.4.2 and mod_python 3.2
>> >
>> > The code works now, it is setting cookies but I don't know what
>> > changed. Sorry for the lack of detail in the original post... first
>> > time :)
>> >
>> >
>> > Thanks for your reply and if I figure out what I've changed in order
>> > for it to work, I'll follow up
>> >
>> >
>> >
>> > On 4/28/06, Jim Gallacher <jpg at jgassociates.ca> wrote:
>> >> Daniel Nogradi wrote:
>> >> >> I'm trying to use the DbmSession class. MemorySession works (for a
>> >> >> single process) but whenever I try using DbmSession, no cookies are
>> >> >> being set in my browser.. Is there something I'm overlooking here?
>> >> >
>> >> > Please post the (minimal) code that you use, that way it will be
>> >> > easier to tell what might go wrong. For example: are the db files
>> >> > created on your server where the session data should be stored?
>> >>
>> >> Also, your OS and mod_python version would be helpful. :)
>> >>
>> >> Jim
>> >>
>> >
>> > _______________________________________________
>> > 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
> 



More information about the Mod_python mailing list