Rene Dudfield wrote:
On 4/30/05, Steve Holden <[EMAIL PROTECTED]> wrote:

[snippety snip]

Seems to me that mod_python isn't really suitable for a shared-hosting environment because of the need to restart the server when indirectly-imported modules are updated, a situation that I believe mod_python does not detect.




I think this is changed since a recent python2.4? Not sure if it also affects mod_python...


from the release notes 'What's New in Python 2.4?': http://www.python.org/2.4.1/NEWS.html

"""When importing a module M raises an exception, Python no longer
leaves M in sys.modules. Before 2.4a2 it did, and a subsequent import
of M would succeed, picking up a module object from sys.modules
reflecting as much of the initialization of M as completed before the
exception was raised. Subsequent imports got no indication that M was
in a partially- initialized state, and the importers could get into
arbitrarily bad trouble as a result (the M they got was in an
unintended state, arbitrarily far removed from M's author's intent).
Now subsequent imports of M will continue raising exceptions (but if,
for example, the source code for M is edited between import attempts,
then perhaps later attempts will succeed, or raise a different
exception).

This can break existing code, but in such cases the code was probably
working before by accident. In the Python source, the only case of
breakage discovered was in a test accidentally relying on a damaged
module remaining in sys.modules. Cases are also known where tests
deliberately provoking import errors remove damaged modules from
sys.modules themselves, and such tests will break now if they do an
unconditional del sys.modules[M]."""


This doesn't affect the situation I was talking about, which has nothing to do with import errors. mod_python will reload one of its application modules if the code is updated on disk - it checks the source files, IIRC, to verify they are still valid.

However, if that module imports another, and that other module is changed, mod_python doesn't "follow the chain" to reload the imported module.

Of course, for pure-Python modules you could arrange to have a page that reloaded all relevant modules, but this is effectively working around the framework rather than using it, it requires separate management, it won't work for extension modules (which can't be reloaded) and it may well leave incompatible objects from previous module versions lying around to cause trouble.

regards
 Steve
--
Steve Holden        +1 703 861 4237  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
_______________________________________________
Web-SIG mailing list
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: 
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com

Reply via email to