[mod_python] Quick question from mod_perl user

snacktime snacktime at gmail.com
Sun Jan 23 00:08:38 EST 2005


> I am not familiar with mod_perl, and thus not totally clear on what you
> mean by "persist" in this particular case, but a global variable within
> a module will in mod_python persist across distinct requests.
> 
> This global though is only accessible to that specific Python
> interpreter,
> thus if using prefork mode of Apache, different processes obviously have
> different versions of that global. If in one process, distinct
> interpreters
> are created, again each interpreter, each has their own version of that
> global.
> 
> Obviously, a global does not persist across restarts.
> 
Ok, so far this is the same as mod perl.

With mod perl I normally create my own request object, usually a
hash/dictionary to store all the values I need to be global.  At the
end of the request I just undefine the one request object instead of
having to remember all the different global variables.  Is this
approach good for mod python as well?

Thanks for the rest of the info, that helped..

Chris


More information about the Mod_python mailing list