[Zope3-dev] zcml abbreviations

Shaun Cutts shaun at cuttshome.net
Thu Feb 16 19:30:03 EST 2006

It seems to me that some of the tension around zcml arises because, on
the one hand, everyone wants it to be as simple as possible, and on the
other, too much simplicity of the language makes some things very
tedious, which encourages "magic shortcuts" via new directives.

To let out some of the steam, could zcml support a very simple
"abbreviate" directive in over all namespaces?

    variables="x y z"

  some complex boilerplate


         bar = y

      baz = z


    z="more spam"

would be equivalent to the abbreviation being expanded. Adding an
abbreviation seems to be much less hard to understand than adding a
whole new directive: you can grep it and, if you understand the base
zcml you can see exactly what the abbreviation does without having to
root around in the python code.

On the other hand, many dotted names that are constant for a given use
can be hidden in the abbreviation.

With this *little* extension, it would seem easier to cut back on the
rest of the directives, as someone's favourite quick way to do something
is more easily removed without howls if they can quickly put it back as
an abbreviation. Note I use "abbreviate" rather than template or macro
not only because they are used in other parts of the system, but because
they have more sophisticated abilities, whereas abbreviations are
limited strictly to name-substitution.

- Shaun

More information about the Zope3-dev mailing list