[mod_python] Force reload?

Shawn Harrison harrison at tbc.net
Thu Feb 3 14:30:38 EST 2005


Shawn Harrison wrote [02/03/05 11:54 AM]:
> Jon-Pierre Gentil wrote [02/02/05 8:59 PM]:
> 
>> Argh!  I wish that mod_python would check all loaded modules for 
>> changes as a flat rule, not as a tree...  because currently it will 
>> only reload something if I touch the handler, because the reload code 
>> sees that the handler hasn't changed and does not bother checking the 
>> modules that the handler uses for changes.  Might as well not even use 
>> mod_python.import() at all.
>>
>> Anyway, is there an option I can use to force the reload of the 
>> handler module each and every time a request is made?  I am only 
>> needing this for debugging purposes, so I don't mind something that is 
>> a bit kludgey.
>>
>> Thank you!  And please fix the import issue!
> 
> 
> Well, sometimes you have to roll up your sleeves when the package 
> doesn't do exactly what you want.
> 
> A solution that hasn't been suggested: write a simple function that 
> imports a module, then reloads it, and returns the module object. Then 
> use that for all imports. You could also define a "PythonOption 
> MyAppDebug True/False" Apache directive, and make the reload instruction 
> in your function only happen if this option is True.

I should have mentioned that you could also just use PythonDebug On and
then you're using req.get_config(), and this would be global. Whereas if
you define your own PythonOption you can turn on/off debugging for
different parts of your application and you'll be using req.get_option().

-- 
________________
harrison at tbc.net



More information about the Mod_python mailing list