[Zope3-dev] Re: ZCML

Philipp von Weitershausen philipp at weitershausen.de
Mon Aug 18 19:58:19 EDT 2003


Shane Hathaway wrote:
> 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" />

Yes, you are right. Maybe be a little more explicit and say

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

> 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.

Let's bring it on!

> 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.

I totally agree. I recently refactored the browser:*form and *wizard 
stuff, so I would be willing to take this at least one step further to::

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

That the 'title' property was actually for the menu and not for the form 
had always bothered me... Any further suggestions before I get started 
with this?

Philipp




More information about the Zope3-dev mailing list