[Zope-dev] Re: [ZODB-Dev] Reloading product in 2.8

Shane Hathaway shane at hathawaymix.org
Mon Jul 18 18:46:28 EDT 2005


Lennart Regebro wrote:
> On 7/15/05, Shane Hathaway <shane at hathawaymix.org> wrote:
> 
>>Indeed, it does work for some people, but I've personally witnessed some
>>very intelligent folks spending hours on problems created by misuse of
>>Refresh.  Maybe this is attributable to documentation.
> 
> 
> could be, because i have now, for several years constantly heard th
> statement that it works if used correclt, but nobody can tell me what
> correctly is... Hence, for me it has been useless even since it became
> part of core.

I think there is documentation inside Zope, but if there isn't, here's a 
start.

1. If no other product depends on the product you're refreshing, and 
your product does not register itself with another product, you can 
refresh your product without setting up dependencies.  Refresh was 
designed for this case.

2. If you want to refresh a base product like CMFCore, you have to 
enable refresh for CMFCore and all products that depend on it, even 
indirectly.  Then you have to set up all dependencies manually, using 
the refresh forms in the control panel.

3. If you want to refresh a product that registers itself with another 
product, you have to set up dependencies like in step #2.  When you want 
to refresh, you have to refresh the product that contains the registry, 
not your own product.  Otherwise the registry will refer to instances of 
the old product classes.

The main symptom of an incomplete refresh is a global variable 
inexplicably bound to None.  When Python reloads a module, it binds all 
global variables in the old module to None.  Refresh tries to clear all 
references to the old module, but it can't see inter-product registries. 
  Therefore, a global variable set to None means the refresh operation 
was not complete, but Refresh doesn't know it.

Shane


More information about the Zope-Dev mailing list