[Grok-dev] Re: ZCML
faassen at startifact.com
Thu Jul 31 09:18:01 EDT 2008
Robert Gravina wrote:
> Being able to override configuration is very powerful... perhaps I
> should learn a bit more about ZCML and the motivations behind it before
> declaring it dead :) I'll go dust off my copy of Weitershausen and spend
> some quality time with it I think :)
While you do this, perhaps you'd like to investigate the following for
us. ZCML has an 'includeOverrides' directive. This allows you to include
a ZCML file that overrides the configuration you already have, for
instance registering a different view with the same name.
For a long time I thought that Grok lacks this feature, but recently I
realized that it probably does, as it's fully compatible with ZCML now.
Here's a sketch of the experimental setup:
You could have two modules, a and b, and a configure.zcml and a
configure_b.zcml. Now in configure.zcml you simply use the ZCML grok
directive to grok module a. Then you do an includeOverrides of
configure_b.zcml, in which you use the grok directive to grok module b.
In module b you have a different view for the same context and with the
same name and layer, just displaying a different text. If
includeOverrides works, you should get no configuration conflict and you
should see this second view. If this works, Grok supports overrides. :)
More information about the Grok-dev