[mod_python] Broken reload algorithm?

Gregory (Grisha) Trubetskoy grisha at modpython.org
Thu Mar 21 10:05:09 EST 2002


It looks like you're right about this - I looked at the Python code
(Python/import.c) and it seems like it searches the path again for reload.
When I wrote this I was under the impression that Python would just reload
the original file from which the module came.

I'll make a note of this.

My mod_python todo list is just getting so huge...

Grisha


On Wed, 20 Mar 2002, Jeff Stearns wrote:

> 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
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
>




More information about the Mod_python mailing list