[Zope3-dev] error checking in included ZCML files

Roger Ineichen dev at projekt01.ch
Sat May 21 07:36:12 EDT 2005


Hi Andreas

Behalf Of Andreas Jung
> Sent: Saturday, May 21, 2005 1:00 PM
> To: zope3-dev at zope.org
> Subject: [Zope3-dev] error checking in included ZCML files
> 
> From: zope3-dev-owner at zope.org
> To: info at zopyx.com
> Subject: Error checking in included zcml files
> Date-Sent: Samstag, 21. Mai 2005 13:03 Uhr
> 
> Hi,
> 
> I tried to refactor the configure.zcml of TextIndexNG3 into a 
> configuration 
> file
> which is related to the core engine and one file that contains Zope 2 
> specific
> directives (browser:view etc).
> 
> The main configure.zcml (to be used by Five) is in
> Products/TextIndexNG3/configure.zcml and contains a line
> 
> <include package="textindexng" file="configure.zcml" />
> 
> So far so good.....just for testing purposes I added the an <utility>
> directive multiple times (which identical attributes) in
> Products/TextIndexNG3/src/textindexng/configure.zcml
> .....I restarted Zope and expected that Zope would not start because
> of the identical directives...however it came up. Adding the same
> identical in Products/TextIndexNG3/configure.zcml caused an exception
> when Zope was starting. So why do we have different behaviour here?
> Bug or Feature?

The ZCML registration process remembers which configure.zcml 
was loaded, this means you can load a configure.zcml more then once.
It only get's loaded one time. (The first time)

If you duplicate a directive directly in a configure.zcml
then it ends in a duplication error. 

This is needed for some use case where you have to load 
a configuration befor they is loaded normaly. (If you add
own packages and have to use some configuration.) 
Because the packages are loaded in a alphabetic 
order. Menus are a good example for this.

btw, this is useful if we don't have different layers
e.g. application layer in 3rd party packages.

This is related to Zope3. I think this is similar to Five.

Regards
Roger Ineichen

> -aj
> 
>     
> --------------------------------------------------------------
> ---------
>    -   Andreas Jung            ZOPYX Software Development and 
> Consulting -
>   -   E-mail: info at zopyx.com   Web: www.zopyx.com             
>           -
>    
> --------------------------------------------------------------
> ---------
> 



More information about the Zope3-dev mailing list