[mod_python] inithandler?

harm harm at millionmonkeys.nl
Tue Sep 18 14:16:19 EST 2001


On Mon, Sep 17, 2001 at 10:59:18PM -0400, Gregory (Grisha) Trubetskoy wrote:
> 
> There is a PythonImport, which essentially does this. It has some severe
> limitations.
> 
> The thing is that mod_python will create separate subinterpreters for
> separate virtual servers (or optionally directories), but the only
> opportunity to learn this information is during request procesing.
> 
> At Apache startup time you can't tell what the subinterpreters will be.

But you do know it the moment the subinterpreters are actually created, 
don`t you? So mod_python could call some handlers the moment it creates 
an fresh interpreter.

Ohwell, as mentioned, it in not _that_ important. Thanks for your reply!

Greetings,
Harmen


> You have an option of manually giving interpreters names and making sure
> that PythonImport executes under a specific name, but it's just kind of
> messy....
> 
> I understand what the problem is, but  can't think of a clean solution to
> it.
> 
> Grisha
> 
> > Moi,
> >
> > first of all thanks for mod_python. I come from an (mod_)perl world and the
> > python version definitely is the easier one to use (There are tons of traps
> > you have to watch out for under mod_perl).
> >
> > 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()
> >
> > but an InitHandler does look like cleaner to me.
> >
> > Any better way to arrange initialisation than the above method?
> >
> > Thanks,
> > Harmen
> >

-- 
                                The Moon is Waxing Crescent (2% of Full)



More information about the Mod_python mailing list