[mod_python] example of the PythonImport directive

m.banaouas banaouas.medialog at wanadoo.fr
Wed Dec 27 04:20:48 EST 2006


The fixup handler is probably the more elegant way to handle database
connexion
I suppose that this connexion (or pool of such objects) will "survive"
(kept alive) between successive requests?
you suggest to cache them in the request object: do you mean like its
usually done with session id, added to all successif url or in hidden
field? or should I add their reference  in the request object during
fixup handler execution time?

from PythonHandler family, PythonInitHandler seems to be an other one 
appropriate for this job, is it ?

To avoid to me any mis-understanding, the long-live connexion object 
will reside as a global module variable ? may be that why "interpretter" 
is usually montionned in PythonImport" threads: the globals will survive 
because the python process is the same one and is never stoped by apache?


Graham Dumpleton a écrit :
> To avoid having to do it in lots of different places, for example if 
> using
> mod_python.publisher, you can define a fixup handler which does it
> for you. The one fixup handler will be invoked for every request in that
> context. You could even cache a reference to the database connection
> handle in the request object ready for the subsequent response handler
> to use it.
>
> Graham
>
> On 27/12/2006, at 7:26 PM, m.banaouas wrote:
>




More information about the Mod_python mailing list