[Zope] Editing downloaded + installed product?

Thomas B. Passin tpassin@mitretek.org
Thu, 21 Oct 1999 16:42:11 -0400


-----Original Message-----
From: Michel Pelletier <michel@digicool.com>
To: 'Thomas B. Passin' <tpassin@mitretek.org>; zope@zope.org <zope@zope.org>
Date: Thursday, October 21, 1999 3:55 PM
Subject: RE: [Zope] Editing downloaded + installed product?


>>
>> I'm having the same problem using Python code as an external
>> method.  The
>> trouble is that when you change the code and rrun it, the
>> Python interpreter has
>> continued to run all the while (since it is running ZServer).
>>  It thinks that
>> all your code has already been bound to the existing method
>> and class names you
>> defined the first time you ran the code, and it doesn't
>> realize there have been
>> changes.
>
>If you click on an external method, and click 'Edit' Zope will reload
>the method.  Further, if you run Zope in debug mode (-D in z2.py)
>external methods will reload every time they are called.
>

Clicking "Edit" will reload the external method, but my external method calls
another Python module which imports or calls a number of other modules.
Clicking "Edit" doesn't help with code changes to those modules.  I have even
introduced deliberate errors into those modules, only to have them run just fine
(until the server is restarted).  I've also tried flushing ZOPE's cache.  This
problem has nothing to do with ZOPE directly - it's a Python interpreter thing.
Yet it makes developing external code in ZOPE annoying. BTW, I AM running Zope
(2.0.1) in -D mode.

>> On the other hand, those reload() calls would take time to
>> execute, so it should
>> be possible to remove them for the production system easily
>> and without ill
>> effects.
>
>In python, you can simply sniff the Globals model for 'DevelopmentMode'
>equalling a true value.  If it it's true, do something debuggish (like
>call reload).

This sounds useful, once I've worked out how to reload everything, not just the
"import spam" parts.
>
>-Michel

Thomas Passin