[Grok-dev] ME GROK RELOAD
Philipp von Weitershausen
philipp at weitershausen.de
Tue Mar 6 11:09:23 EST 2007
On 6 Mar 2007, at 11:02 , Christian Theune wrote:
> I'm working on a better Zope 2 product refresh mechanism right now and
> compared that to what you did here.
> Guido van Rossum came up with a good approach that works a lot
> better in
> the context of ZODB applications as he doesn't unload the existing
> module, but imports the module again into a new namespace and does
> surgical operations to apply code updates in-place and keep references
Yes, I've seen that (I assume you're talking about xreload.py). I've
been wanting to try that out in a grok context.
> I'm also implementing a rather gross approach on refreshing ZCML by
> simply emptying the global site manager and telling Five to
> again. All in all this seems to work quite well.
Cool. Note that emptying the site manager often isn't enough. ZCML
does other global setup. Something like the global cleanup hook we
use for testing should probably be used in this case.
For grok, I made grokkers implement an "ungrok" method in which they
would have to take back whatever they did in "register". That worked
quite well and insanely fast because all the ZCML setup in Zope
stayed as it is, it didn't have to be reloaded.
> I do have to provide a couple of very gross hacks though that I'm
> researching by using this on a large site with many products.
> If you want to look at the code, check launchpad.net/refreshng
> (The code is very gross right now as I'm still in the 'getting it
Great (haven't looked at the code yet)! Perhaps it can be made so
that grok can simply use it as a dependency. It would certainly rock
if grok would use the same mechanism as Zope (2/3) itself.
Thanks for looking into this!
More information about the Grok-dev