[mod_python] Session management

Ron Reisor ron at udel.edu
Tue Jan 11 16:39:55 EST 2005


Chris,

    Make "sess" be local to your handler function.  That function is called 
to handle one request. So, create the "sess" reference early in the 
function, do stuff with it to retrieve or update information, then make 
sure you do a "sess.save()" before the handler function exits.

cheers,

Ron


On Tue, 11 Jan 2005, Chris Jackson wrote:

> <myconfig>
> mod_python version = 3.1.3
> Apache version = 2.0.52
> python version = 2.4
> </myconfig>
>
> My goal is to allow the creation of multiple, separate sessions, as
> well as create global variables which all sessions have access to.
> I'm having trouble understanding how to use mod_python.Session even
> after looking at the available documentation.  In particular, i'm
> concerned with where to put "sess = Session(req)."
>
> I'm a little fuzzy on the memory space or variable scoping.  Apache
> runs multiple threads, and there's a single embedded python
> interpreter.  When multiple requests from different locations hit my
> mod_python page, all these requests get processed under the same
> interpreter?  I want to use sessions because I think some of the data
> is being overlapped/shared between different requests, but I want data
> to be rationed out in sessions and some data still shared between
> sessions such as a database connection object.
>
> Any help on this will be much appreciated.
>
> ~= Chris =~
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>

Ron Reisor <ron at udel.edu> (RWR3)
University of Delaware Information Technologies/Network and Systems Services
Computing Center/192 South Chapel Street/Newark DE, 19716
pgp finger print: 0D 73 06 6F D3 6A 99 D3  F5 D5 6E FF 3B B9 7C 2C


More information about the Mod_python mailing list