[mod_python] inithandler?

Geert Jansen geert at boskant.nl
Tue Sep 18 10:15:11 EST 2001


You wrote:

> Anyway. My tiny question.
>
> Why is there no init handler? It would run the moment the python
> interpreter gets loaded/intiated by the freshly forked apache. It
> would be a
> nice place to initialise some site global modules.
>
> Sure, I could do a:
> if not mypersistentvar:
>    mypersistentvar = Some.Nice.Object()

I'm afraid this is currently the only way. I use the technique too, and I
don't think it is unacceptably ugly :) And it works very well.

I am curious how mod_perl implements this init handler. I bet it runs it at
request time, setting a flag init_done when it has been called.

Recently I had problems implementing a "once for _all_ childs" initialiser
function, but that's another issue. See the recent mailing list archive if
you're interested.

Greetings,
Geert




More information about the Mod_python mailing list