[Zope3-dev] RFC: Reducing the amount of ZCML directives

Lennart Regebro regebro at gmail.com
Mon Feb 13 07:17:13 EST 2006


On 2/13/06, Philipp von Weitershausen <philipp at weitershausen.de> wrote:
> Hi all,
>
> looking for your comments at
> http://dev.zope.org/Zope3/ReducingTheAmountOfZCMLDirectives :)
>
> This is a "formal" follow-up on my blog post on ZCML a while back
> (http://www.z3lab.org/sections/blogs/philipp-weitershausen/2005_12_14_zcml-needs-to-do-less).
> I expect there will be more proposals in this direction, this is just the
> beginning. It is also the easy part.

Uhm. -1, actually. I think getting things out of ZCML is a good idea,
but I think this shoots slightly beside the goal. This proposal aims
mostly at getting rid of statements that can be done with other
statetements, but using more lines. I think that goal is misguided, as
it would require you to make longet ZCML files with more basic
statements. This in  turns means you need to understand more of what
you are actually doing. Remember that many of these statements were
introduced because ZCML was too obscure and you needed to understand a
lot of different interfaces do know between which interfaces to adapt
for example.

Many of the statements you want to deprecate should be deprecated,
true. But I think the main effort of ZCML simplification is to move
things into Python that does not belong into ZCML at all. And my main
contender for ZCML deprecation would be the adapter statements.  As
you say. "In general, ZCML should only be responsible for registering
a component, but not for defining its behaviour". When you write an
adpater, it will be hardcoded into the adapter itself which interfaces
it adapts between. You can not take an adapter written to adapt
between two interfaces and use them to adapt between two completely
different intefaces, for obvious reasons. So why would the adapter
statement be necessary at all? Well, currently I think it's necessary
because we need to have adapter factories, and there are
multi-adapters and such. But somehow I feel that at least most of
these cases can be done without any ZCML statements at all.

Simplification of ZCML should have the goal not to have less
statements, but not to do things in ZCML that shouldn't be done in
ZCML, and to have statements that are easy to understand, even for
people who do not have all interfaces in zope.app in their head.

--
Lennart Regebro, Nuxeo     http://www.nuxeo.com/
CPS Content Management     http://www.cps-project.org/


More information about the Zope3-dev mailing list