[Grok-dev] side effect in grok configure.zcml
Philipp von Weitershausen
philipp at weitershausen.de
Thu Aug 21 09:01:46 EDT 2008
Godefroid Chapelle wrote:
> Starting the application did work. However, launch of tests was stuck
> with a configuration conflict on default skin (iow the includeOverrides
> did not work).
>
> We took some time to find out that the problem is due to grok being
> included twice when using ftesting.zcml = when launching tests.
While the <include /> directive occurs twice, the ZCML isn't actually
executed twice. It's just executed the first time.
The error you're describing is actually the expected behaviour, once you
understand overrides. You see, overrides can only override things at the
same level that they're being included at. So, when you have
myproject/configure.zcml reading like this:
<include package="grok" />
...
<includeOverides file="overrides.zcml" />
the overrides.zcml actually has a chance at overriding stuff from Grok
because it's included at the same level. However, the (faulty)
ftesting.zcml reads (with includes "expanded" where necessary):
<include package="grok" />
<include package="myproject" />
|
--> <include package="grok /> (***)
...
<includeOverrides file="overrides.zcml" />
(***) is never executed because grok/configure.zcml has already been
loaded in the first line. And now the overrides is one level down from
grok/configure.zcml and has no chance at overriding things.
The solution here is to fix ftesting.zcml. It should never actually
include grok/configure.zcml in the first place. myproject/configure.zcml
already does that.
Please make sure this gets fixed in grokproject as well (either by
fixing and testing it yourself, or by submitting an issue in Launchpad).
Thanks!
More information about the Grok-dev
mailing list