[Zope3-dev] Re: ZCML

Shane Hathaway shane at zope.com
Mon Aug 18 19:40:42 EDT 2003


Jeremy Hylton wrote:
> If ZCML is a dividing issue, I wish there was a way to make the division
> less prominent.  Perhaps more than one way to do it?  Is it just the
> syntax that bothers you, Shane, or is it deeper than that?

The first thing that bothers me is that overriding directives looks 
problematic.  Take the following directive from onlinehelp.zcml:

   <pages
       for="zope.app.interfaces.onlinehelp.IOnlineHelpTopic"
       permission="zope.Public"
       class=".onlinehelp.OnlineHelpTopicView">

       <page name="index.html" template="onlinehelptopic.pt"/>
       <page name="getTopicTree" attribute="getTopicTree"/>
   </pages>

Let's say I'm preparing a semi-public site.  I don't want the help 
system to be public, but I do want certain users to be able to see it. 
I don't want to modify onlinehelp.zcml, so I proceed to add a directive 
to my site.zcml.

...But wait a minute, what should I write?  Do I have to copy and paste 
the entire <pages> tag?  If I do that, do I have to track changes when I 
upgrade Zope?  This doesn't seem right.  I'd really like to write just this:

   <pages
       permission="myapp.MyPermission"
       class="zope.app.browser.onlinehelp.OnlineHelpTopicView" />

The lack of "minimal override" capability has been quite painful for 
Zope Corporation.  We write and maintain complex "buildout" scripts that 
serve a similar function as site.zcml.  The buildout scripts have to 
duplicate and keep in sync with other software.  I'm not sure that ZCML, 
in its current form, will solve the complex buildout problem.

In the Ape project, I found a way to achieve minimal overrides that 
wasn't too burdensome.  I'd like to discuss how we can improve upon the 
approach Ape takes, without losing the schema-based configuration we 
have now.  I have some ideas.

The second thing that bothers me is that some directives use a lot of 
attributes, and some of those attributes clash in comprehension. 
"browser:editform" has both a "label" and a "title" attribute, for 
example.  It turns out that "label" is text describing the form, and 
"title" is text describing the menu item.  It would be simpler to have a 
"menu" child element.

As another example, the following directive is too much to swallow at once:

     <browser:editform
       schema="zope.app.content.image.IImage"
       name="upload.html"
       menu="zmi_views" title="Upload"
       label="Upload an image"
       permission="zope.ManageContent"
       class=".image.ImageUpload."
       template="imageedit.pt"
       />

There are too many concepts mixed in one tag.  It needs to be split up.

Shane




More information about the Zope3-dev mailing list