[mod_python] Sessions again...

Graham Dumpleton grahamd at dscpl.com.au
Thu Jan 19 17:51:17 EST 2006


Jim Gallacher wrote ..
> Luis M. Gonzalez wrote:
> > What could be the problem?
> > Any hint would be highy appreciated...
> 
> You'll need to clarify your problem a little, but I think you may be 
> assuming that you get a different session object for each script. That
> is not the case, at least by default. You get one session object per 
> browser so if you want to use it in independent scripts, each script 
> will need to catch the KeyError exception or do some other test to see
> if you need to initialize your session data.

Would more or less agree with Jim, but also point out that if you do
need distinct session objects to be used for different parts of your URL
namespace, you really need to put the distinct scripts in different
directories and for each directory root to have its own PythonHandler
directive. From memory that is enough to trigger a different context
for sessions to operate in.

Otherwise you need to be setting the ApplicationPath option value in
the Apache configuration so it is different for each part of the URL
namespace. That is still going to be hard if you have all your scripts
in the same directory. There is reference to ApplicationPath in:

  http://www.modpython.org/live/current/doc-html/pyapi-sess-classes.html

It is probably not obvious though what the option is really about.

Graham


More information about the Mod_python mailing list