[Zope3-checkins] SVN: Zope3/trunk/ Add ZCML support for conditional directives using the zcml:condition

Fred Drake fdrake at gmail.com
Fri Jan 7 13:09:32 EST 2005


On Fri, 7 Jan 2005 12:46:26 -0500, Stephan Richter
<srichter at cosmos.phy.tufts.edu> wrote:
> I was waiting for the day when this would happen. Doesn't this violate the
> pricniple that we don't want to evolve ZCML to a language? The reason we
> chose ZCML over Python was that we did not want all the powerful features of
> a true programming language.

We don't want to evolve ZCML to become a general-purpose language, no.
 But we do want some basic facilities, I think, and one is to be able
to say "include that stuff over there, but only on platform A". 
(Windows, in our specific case).

There are different ways this could be done that expose less, but
selecting exactly the right one is unlikely to be possible (much less
agreed on).  If we provide some sort of platform test, then getting
that test right is difficult at best; is it a regular expression
match, exact match, or something else?  Do we compare with
sys.platform, os.name, or something else?  There are a lot of bits of
platform information available in the "platform" module; doing the
"right thing" isn't likely to be the right thing here.

Another possibility we considered was to identify some Python callable
by making the condition a GlobalObject field.  The object would be
called to get a boolean result.  At this point, we'd pretty much have
what we have now: anything's possible, and not just platform checks.

So we simply decided on something.

We actually discussed the possibility of implementing a zcml:define
attribute as well, and that's not ruled out.  We didn't need it right
away, though, so haven't done so.


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
Zope Corporation


More information about the Zope3-Checkins mailing list