[Grok-dev] Re: Global utilities registered too early?

Martijn Faassen faassen at startifact.com
Tue Jun 19 08:38:51 EDT 2007


Jan-Wijbrand Kolman wrote:
> FYI: I put a print statement in registerUtility() in z.c.registry and
> indeed it seems utilities that are registered thru grok are registered
> *before any other* utility that gets registered in core zope packages
> and "third party non-grok" pacakges. HTH.

This is because Grok doesn't use actions yet, like ZCML does. Reading 
ZCML generates a whole bunch of actions, and only at the end of all the 
ZCML reading are all actions resolved (things may fail here with 
conflicts) and then executed.

The grok directive triggers the grokkers. The grokkers directly register 
everything with the component architecture (including the global utilities).

We need to change this. The path is reasonably clear, but I haven't 
found the time yet to work on this, and likely won't before EuroPython 
at the least:

* change grok core so it uses Martian. This is not strictly necessary to 
do actions, but since we're going to touch all grokkers anyway, better 
get it over with first.

* change all grokkers to generate actions. This will likely make us grow 
new infrastructure to do so. The actions should have discriminators 
compatible with those created by ZCML, so that conflicts work the ZCML 
way. We also should make sure overrides work the ZCML way (I think that 
already works if we do this, but we need to test it and analyze the 
consequences). Our actions can be home-grown; there is no need to reuse 
ZCML's actions, just to use discriminator tuples that will conflict 
appropriately with those from ZCML.



More information about the Grok-dev mailing list