[mod_python] Force reload?

Shawn Harrison harrison at tbc.net
Thu Feb 3 12:54:18 EST 2005


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.
-- 
________________
harrison at tbc.net


More information about the Mod_python mailing list