[Zope3-dev] z3 in z2 land, zcml vs. yaml, and a new year

Shane Hathaway shane at zope.com
Thu Jan 1 04:37:59 EST 2004


On Wed, 31 Dec 2003, tav wrote:

> adapter:
> 
>  for:		.interfaces.IWikiPage
>  provides:	zope.app.interfaces.file.IWriteFile
>  factory:	.wikipage.WikiPageWriteFile
>  permission:	zopeproducts.zwiki.EditWikiPage
> 
> event:
> 
>  subscriber: .wikipage.mailer
> 
>  event_types:
>   - zope.app.interfaces.event.IObjectAddedEvent
>   - zope.app.interfaces.event.IObjectModifiedEvent
>   - zope.app.interfaces.event.IObjectRemovedEvent
>   - zope.app.interfaces.event.IObjectMovedEvent

Presented this way, this is quite appealing.  It's just Python indentation
and colons.  I dislike yaml because it relies too much on cryptic
punctuation, but this simple subset is more useful.

If you remove the dashes, the mapping from this syntax to XML structure is
obvious: first-level lines are elements, second-level lines are
attributes, and third-level lines are attribute values.  Nested elements
are not possible, but multi-line attributes are easier than ever.  From
the ZCML I've seen, it doesn't look like we want nested elements anyway.

The one thing that's not so obvious is namespaces.  The following 
declaration needs the name "browser" to get mapped to 
"http://namespaces.zope.org/browser" somehow:


browser.page:
    class:      .interfacewidget.InterfaceWidget
    for:        zope.app.interfaces.component.IInterfaceField
    name:       edit
    permission: zope.Public


Whether you use YAML or this simpler subset, I think that if you write a
utility capable of converting all existing ZCML to the new format and show
how great an improvement it makes, you can influence the direction ZCML
takes.  It's not going to be easy because this topic has already been
discussed to death, but I hope you work at it anyway.  All those angle 
brackets and quotes are sacrifices to the SGML idol.

In fact, I'm thinking about switching Ape's configuration language to this 
syntax instead of XML.  I'd be able to use regular old Python mode (with 
syntax highlighting turned off) to edit these files.  That would be very 
neat.

Shane



More information about the Zope3-dev mailing list