[Zope3-dev] ZCML alternative

Jeffrey P Shell jeffrey@cuemedia.com
Tue, 04 Jun 2002 16:05:13 -0600


On 6/4/02 3:46 PM, "Shane Hathaway" <shane@zope.com> wrote:

> Steve Alexander wrote:
>> Namespaces are important for making the configuration system extensible.
> 
> Jeffrey's example was *a lot* easier to read.  Site managers are a lot
> more familiar with that kind of XML than namespace-loaded XML.
> 
> We can have extensibility without namespaces.  The extensibility would
> be more limited, but in fact, it currently seems too inviting for
> developers to create their own directives.

I've noticed how SOAP allows - and in fact prefers - people making their own
directives.  I think it works for the purposes of SOAP, but I can never read
a SOAP envelope easily.  I think namespaces work well for situations like
Page Templates, and for machine read/written XML, but not for purposes where
a human has to not only enter the code in, but be able to edit and maintain
it as well (with rememberance that maintenance is often done rapidly in VI
or Notepad).

> Here's your example rewritten in more conventional XML.  If we're using
> XML to make ZCML familiar, we'll gain the most mileage by using a
> familiar style of XML.
> 
> 
> <permission id="Zope.Manage">Manage Contacts</permission>
> 
> <content class="Zope.Contact.">
> <require permission="Zope.View">
>  <attribute>name</attribute>
>  <attribute>first</attribute>
>  <attribute>last</attribute>
>  <attribute>email</attribute>
>  <attribute>address</attribute>
>  <attribute>postal_code</attribute>
> </require>
> <require permission="Zope.Manage">
>  <zmi-factory id="Zope.Contact">
>   <title>Contact</title>
>  </zmi-factory>
> </require>
> </content>

Yes!  That's much better.  That's easily human AND machine AND tool (ie
XMetal (is that still around?), GoLive, an Outliner etc) readable.  It's
more Pythonic.  And it doesn't hurt my head to look at, like current ZCML
does.

I seriously do what it takes to avoid current ZCML, and I wager I won't be
the only one who feels that way when it makes it into the world.  If it's
simple and nice, it's more likely to be used properly.  If it's terse and
weird (the comma/space separated attribute values have really bothered me),
people will more likely have mistakes, and use it grudgingly and/or poorly.

> One thing I experimented with in the example above is the notion that
> you can't do anything with a content class unless permission is granted
> in some way, so the "require" element is reused to declare the ZMI factory.



-- 
Jeffrey P Shell 
www.cuemedia.com