[Zope3-dev] About zcml:condition

Martijn Faassen faassen at infrae.com
Mon Jan 10 13:41:11 EST 2005


Hi,

This discussion was taking place on the zope3-checkins list, and I 
didn't want it to be lost there without any public discussion.

Stephan Richter wrote:
> On Friday 07 January 2005 11:43, Fred L. Drake, Jr. wrote:
> 
>>Log message for revision 28766:
>>  Add ZCML support for conditional directives using the zcml:condition
>>  attribute.  The value of the attribute is a TALES expression; if the
>>  expression is true, the element the attribute is attached to will be
>>  used, otherwise the element and its descendents will be ignored.
> 
> 
> 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.
> 

To me this is a rather major conceptual change. My worries grow the more 
I think about it.

I don't know anything about the details of how these TALES expressions 
get evaluated (in what context, etc), so I may be misinterpreting this, but:

I am worried about allowing people to write Python code in ZCML. Only 
allowing a simple expression language like path expressions, accessing 
some predefined context, would be far more palatable to me. Python 
conditionals could, by calling into a large codebase, affect some 
arbitrary part of that codebase. Side effects might happen, errors could 
occur. Python expressions also harm the processability of ZCML by 
external tools which want to do some analysis of ZCML code. This 
includes Zope 3 source code analysis tools and authoring environments.

I'm therefore worried that Python expressions could compromise the 
declarative nature of ZCML. I think that the genericity of using Python 
in ZCML is a YAGNI; a simpler fix would be to have conditionals depend 
on some simple, predefined and precalculated state that starts before 
ZCML processing begins. This could include things like the platform.

Regards,

Martijn


More information about the Zope3-dev mailing list