[Zpt] TALES
Evan Simpson
evan@digicool.com
Fri, 2 Mar 2001 11:20:21 -0500
I added comments to Todd's comments on TALES. I have a few issues for
discussion.
First, I suggest adding a way to handle existence testing:
Add expression type "exists", which takes a path expression and returns a
boolean value indicating whether the path successfully resolves::
<span z:condition="exists:template/annotation"
z:replace="template/annotation">
Alternatively, make path expressions that fail to resolve evaluate to
singleton value "Undefined" instead of raising an exception. "Undefined"
would be false, so we could write::
<span z:define="ann template/annotation" z:condition="ann"
z:replace="ann">
Next, how should path resolution in Python expressions look? I think that
we have agreed to make all template variables available to Python
expressions directly, so that we can simply write expression like "python: x
+ y". What about paths, though? The alternatives seem to be::
<span z:define="x here/to/there" z:condition="python: x == 1">
or
<span z:condition="python: here.restrictedTraverse('to/there') == 1">
Is this acceptable?
Cheers,
Evan @ digicool