[Zope] Refreshing modules imported into external methods
Michael Hartl
michael_hartl at yahoo.com
Sat Dec 20 15:55:14 EST 2003
> This is irrelevant to how a long-running program works. If you reloaded
> Zope every time you executed a request, you'd see the same behavior...
> eventually. :-)
>
> For non-trivial software, Python's "ordinary" behavior is the opposite of
> what you described.
I guess it depends on what you consider "trivial" software or "ordinary"
behavior. As an example, suppose you were to replicate all the standard Unix
utilities as Python programs (wc.py, grep.py, head.py, tail.py, awk.py,
etc.),
so that, e.g., 'wc.py file' would count the words in a file. Then modules
imported into any of these programs would be updated automatically just as I
described. Surely the entire corpus of Unix utilities cannot be said to
consist only of "trivial" programs!
In fact, any Python program that follows the "do something, then return to
the shell" paradigm will behave exactly as I described. This is probably the
most common Linux/Unix paradigm, and includes many highly nontrivial programs
such as gcc, make, and (La)TeX. I agree that a program running persistently
(i.e., what you call a "long-running program") won't behave in the way I
described, but there are many nontrivial programs that don't fit this model.
One might argue that Zope is precisely such a long-running (persistent)
program, so its behavior should be expected. The reason that Zope's behavior
surprised me is that changes to the external method file *were* immediately
reflected in my Zope pages (i.e., without restarting Zope or even clicking on
'Save Changes' in the external method's properties). This means that Zope
must be reparsing the external method's file, much as invoking a program from
the command line forces a file reparsing. In the command line case, when a
file is parsed all included modules are checked for updates and re-imported
if necessary. In light of this, my expectation for Zope's behavior, though
incorrect, doesn't seem unreasonable to me.
Michael
=====
Michael Hartl
http://www.michaelhartl.com/
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
More information about the Zope
mailing list