[Zope] evaluating a "sequence-item" within a dtml-if statement
Dylan Reinhardt
zope at dylanreinhardt.com
Mon Sep 15 12:47:10 EDT 2003
On Mon, 2003-09-15 at 09:25, Roger Mallett wrote:
> The code below fails with: "invalid syntax (line 1).
>
>
> <dtml-in expr="[1,2,3,4,5,6]">
> <dtml-if expr="&dtml-sequence-item;==3">
> &dtml-sequence-item;
> <dtml-else>
> failed
> </dtml-if>
> </dtml-in>
>
Use the "prefix" attribute any time you need to use a sequence variable
in a Python expression. Better yet, use them all the time.
Try this:
-----
<dtml-in "[1,2,3,4,5,6]" prefix=my>
<dtml-if "my_item==3">
&dtml-my_item;
<dtml-else>
failed
</dtml-if>
</dtml-in>
-----
HTH,
Dylan
More information about the Zope
mailing list