[Zope3-dev] ZCML alternative

Stephan Richter srichter@cbu.edu
Sun, 2 Jun 2002 02:59:12 -0400


> I've been thinking about the difficulty Itamar had recently.  Several
> months ago, he integrated Twisted (an Internet protocol framework) into
> Zope 3 with very little effort.  It was an exciting thing to be able to
> do.  But after we converted the startup procedure to use ZCML, Itamar
> tried again to integrate Twisted and failed, because the startup
> mechanisms were too hard to decipher.  I tried to help, but I couldn't
> wrap my head around what it would take to add a different kind of server
> either.  Itamar blamed ZCML, and I tried to convince him otherwise, but
> now I'm having second thoughts.

Actually nothing changed really. All he had to do is provide his own z3.py=
=20
file and deactivate some of the server setup ZCML. It was actually not as b=
ad=20
as he made it sound.

> Some specific problems with ZCML:
>
> - It's hard to find the code that processes a given directive.

Mmh, I disagree. You have several ways to track the code down. I usually tr=
y=20
to use a sensable namespace that corresponds to the code. At all times the=
=20
meta directives and their handling code are in the same directory:

meta-<namespace>.zcml <-- The namespace part is my personal convention
metaConfigure.py <-- This name should probably change.

> - It's hard to tell what a ZCML file depends on without reading every lin=
e.

Well, not really. If people use the namespace declarations correctly, you c=
an=20
get a general idea of what the ZCML does in a particular file.  Other than=
=20
that, I think it is in the nature of ZCML that every line might have=20
dependencies. But I think with the new compact form the lines will become=20
much less.

> - You can't easily use debugging tools, like "print" statements, pdb, or
> the interactive interpreter.  We have tracebacks, but they aren't very
> clear.

This is something I totally agree with you on. We **really** have to work o=
n=20
the error message output before Zope 3 goes prime time.

> - We've had to invent syntax to cover things that XML does not address,
> like Python imports and lists.

Well, I think ZCML has also an advantage here. In Python we cannot do relat=
ive=20
imports; in ZCML we can. I think this is very important.=20

<snip Python JobBoard>

> Comments?

Yes, you forgot another huge advantage of ZCML. ZCML is not aimed at the=20
developer, but at the site admin. This way the admin does not have to use a=
nd=20
learn Python in order to configure Zope, but use a syntax (XML) which s/he =
is=20
most likely familiar with. I think that often Site Admins will end up being=
=20
high level Web developers which only know HTML+Tools and JS. We widen Zope =
up=20
to a much wider audience by using ZCML.=20
I can understand your concerns though, since most of the current ZCML is ve=
ry=20
low-level. But once products will be written, I think the advantages will=20
become quickly obvious. However, in order for ZCML to be successful, we nee=
d=20
better error messages; that is a point I agree with you 100% on.=20

Regards,
Stephan

=2D-=20
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training