[mod_python] About module autoreload

Graham Dumpleton grahamd at dscpl.com.au
Sun Feb 20 02:40:52 EST 2005


On 20/02/2005, at 6:07 PM, Gonzalo Sainz-Trápaga wrote:

> Hi,
> After reading the FAQ entry 3.1, i finally built my custom way to 
> import
> modules, on the lines of:
>
> -- config.py --
> debug = True
> --
>
> -- anyscript.py --
> from mod_python.apache import import_module
> config = import_module('config')
> if config.debug:
>     # reload other modules

The prototype of import_module is:

   import_module(module_name, autoreload=1, log=0, path=None)

Thus, when you use it explicitly, the value of PythonAutoReload is 
meaningless,
you have to explicitly say if autoreload is to happen or not. The 
default when you
use import_module() explicitly is that autoreload is on.

In other words PythonAutoReaload only applies to top level imports 
performed
by mod_python itself and not any you may do.

Graham



More information about the Mod_python mailing list