Re: [ZODB-Dev] Reloading product in 2.8
[switching to zope-dev] Sidnei da Silva wrote:
On Fri, Jul 15, 2005 at 07:49:10PM +0200, Dieter Maurer wrote: | But, it does not need to fail -- provided that with a product | all its dependent products are refreshed as well. | | At least, I never saw it failing when I had met this condition... | | And I lost time only when I saw the not very helpful problem messages | for the first few times (when I did not met this condition). | | But otherwise, refresh saved me *lots* of time...
Same here. If you know the gotchas and you program properly it can work flawleslly. Hell, I've even been able to refresh Archetypes products, what can be more prone to fail than that?
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. At the time Refresh was created, Zope products were generally simpler and didn't have any run-time registries. Refresh is now less reliable mainly because products are more sophisticated. Shane
On 7/15/05, Shane Hathaway <shane@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. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/
Lennart Regebro wrote:
On 7/15/05, Shane Hathaway <shane@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
Shane Hathaway wrote at 2005-7-18 16:46 -0600:
... 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.
I think when the product with the registry behaves like this (i.e. it keeps the old entries rather than takes the newly registered ones) this product does something wrong. The best way would be to fix this product... Otherwise (just to be explicit about this), you need to refresh both products: the one with the registry and the registering product. -- Dieter
participants (3)
-
Dieter Maurer -
Lennart Regebro -
Shane Hathaway