[Zope3-dev] what is ZCML?

Alec Mitchell apm13 at columbia.edu
Mon Mar 13 15:22:40 EST 2006


On Monday 13 March 2006 10:59, Dieter Maurer wrote:
> Martijn Faassen wrote at 2006-3-13 17:15 +0100:
> > ...
> >A newer interpretation of ZCML is:
> >
> >"""
> >ZCML is a configuration language that configures a number of basic
> >directives for configuring the component architecture and security:
> >adapters, utilities, security requirements, and little else. Everything
> >else should be done in Python code, as configuration in Python code is
> >more flexible and packages can form a more self-contained whole. ZCML
> >should reflect the underlying universality of the component architecture.
> >
> >If two directives work with, say, adapters underneath, they should
> >really be one directive. ZCML should be simple and minimal so it is easy
> >to grasp.
> >
> >ZCML is not readable standalone. ZCML is simply used to turn on various
> >adapters and such, hooking them into the system, but we do not get a
> >clue what the adapters are doing by just looking at the ZCML - Python
> >code needs to be consulted.
> >"""
> >
> >I believe that this interpretation is the up-and-coming interpretation
> >of ZCML.
>
> I hope not...
>
> Note, that configuration files should be understand and
> adaptable by administrators. Therefore, they should be readable
> and understandable -- without an understanding of the implementation
> (but with reading of the component documentation).

+1 The first time I saw:

<adapter factory=".MyFactory" />

I was a bit disturbed.  What's the point?  It tells you nothing unless you 
refer to the actual implementation.  Why not just put the registration in 
python alongside the implementation if that's where the configuration of 
provided and required interfaces is going to be?  I had considered one of 
zcml configuration's greatest benefits was that it could give a high level 
overview of how pieces of a package were interconnected.  Of course it's 
still possbile to do things the old way, but I get the impression that it's 
discouraged.  Brevity is not always a boon, though that cuts both ways here 
(adding a new "magical" seeming zcml declaration to save a copy/paste here 
and there may not be the best idea either).

Alec


More information about the Zope3-dev mailing list