[z3-five] Re: alphabetical order, skins and layers

Philipp von Weitershausen philipp at weitershausen.de
Thu Apr 28 13:36:16 CEST 2005


Jan-Wijbrand Kolman wrote:
> I think I found a little problem in how Five loads the configure.zcml of
> Products. As I understand, by default, Five will retrieve a Product listing of
> the Zope instance used and looks inside the Products directory to see if there's
> configure.zcml.
> 
> Now, if Product "Y" defines a set of layers, that Product "A" likes to reuse in
> its own skin, loading the configure.zcml of Product "A" fails with a
> configuration error:
> 
>   zope.configuration.config.ConfigurationExecutionError: exceptions.ValueError:
>     ('Undefined layers', [u'layer_defined_in_y'])
> 
> Apparently, the alphabetical order of the installed Products matter in this
> case. I confirmed this by renaming Product "A" into "Z". Then, the configuration
> went just fine.
> 
> I don't know if other configuration aspects might have the same problem.
> 
> There's one work-around: place a site.zcml in the Zope instance's .../etc/
> directory. This will override Five's default "look in all Products for a
> configure.zcml"-behaviour, and just load only what is defined in the site.zcml,
> in that order.
> 
> This is nice and explicit maybe, but is not very Zope-2-ish where people are
> used to drop in a Product in the .../Products directory and have it working.

It is at least one way of dealing with custom site configuration. People 
who are attracted to doing it in an explicit, Zope3-style fashion, might 
prefer to do it that way.

I can understand your concerns about not being Zope2ish though.

> Maybe we can solve this by introducing an optional "I depend on Product Y to be
> configured before me"-attribute defined in the Product's __init__.py or
> something? Or maybe there's other ways?

Well, that "I depend on on Product Y to be configured for me" thing is 
very very easy. Simply say <include package="Products.Y" /> at the top 
of your A product configuration. The ZCML machinery is smart enough not 
to process an already processed file again...

> Personally I hope we can get around this soon, have it in Five-1.0.1 and get
> this in Zope-2.8... Or better even, that I did something wrong or overlooked
> some way to prevent this alphabetical order issue all together.

I think the only change in Five that would be needed is a small 
paragraph in the documentation explaining the above solution (explicit 
include in the dependent package).

Philipp


More information about the z3-five mailing list