[Grok-dev] side effect in grok configure.zcml

Godefroid Chapelle gotcha at bubblenet.be
Thu Aug 21 08:26:57 EDT 2008


Hi all,

We got stuck this morning with the problem described below.

First, here is the top level configure.zcml we were using. (It was 
generated by grokproject, we just added the includeOverrides)

configure.zcml


"""
<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:grok="http://namespaces.zope.org/grok"
           >

  <include package="grok" />

  <includeDependencies package="." />

  <grok:grok package="." />

  <includeOverrides file="skin.zcml" />

</configure>
"""


skin.zcml


"""
<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:browser="http://namespaces.zope.org/browser"
           >

  <browser:defaultSkin name="myskin" />

</configure>
"""





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.

See beginning of (generated by grokproject) ftesting.zcml :

"""
<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:grok="http://namespaces.zope.org/grok"
           xmlns:browser="http://namespaces.zope.org/browser"
           >

  <include package="grok" />
  <include package="myproject" />
...


"""

If we remove the <include package="grok" /> line in ftesting.zcml,
everything work again.

I suggest to fix the ftesting.zcml template of grokproject.

However, a system broken by zcml included twice stinks.

Reason why we have explored a bit further. By changing our top level 
configure.zcml to the code below, we managed to break both zope startup 
and tests startup.

This way, grok package is included twice in both cases. This does 
exclude that the problem is related to a difference in loading zcml - it 
does confirm that the bug is somewhere in the zcml included with grok 
package.


configure.zcml

"""
<configure xmlns="http://namespaces.zope.org/zope">

  <include package="grok" />

  <include file="include.zcml" />

</configure>
"""

include.zcml

"""
<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:grok="http://namespaces.zope.org/grok"
           >

  <include package="grok" />

  <includeDependencies package="." />

  <grok:grok package="." />

  <includeOverrides file="skin.zcml" />

</configure>
"""

I think it is worth adding a test and to fix the side effect.

Where should I add that test ? (I do not have time to fix the bug this 
week but would rather not loose the info about the bug)

HTH
-- 
Godefroid Chapelle (aka __gotcha) http://bubblenet.be


More information about the Grok-dev mailing list