[mod_python] Broken reload algorithm?

Jeff Stearns jeffstearns at attbi.com
Wed Mar 20 23:50:22 EST 2002


I'm using the publisher handler with mod_python 2.7.6.  I'm doing 
development, so auto-reload is turned on.

This causes broken behavior.  I blame it on line 365 in apache.py:

     # if module is newer - reload
     if (autoreload and (oldmtime < mtime)):
         module = reload(module)

The code here assumes that the module can be found in sys.path. But 
that's not guaranteed when using publisher. The module may be found 
anywhere in the document tree.  Unfortunately, that provokes an 
exception.

I believe that the call to reload() should be replaced with 
imp.load_module(). The imp.load_module function *does* handle reloading, 
and it can be given the path to the module.  Unfortunately, the code 
needs to be reworked to test this theory.

Comments?  Am I missing the point here?

thx - jeff stearns




More information about the Mod_python mailing list