[Zope] checking for elements in a list

Andreas Jung lists at andreas-jung.com
Fri Dec 2 07:47:38 EST 2005


You should definitely move such *complex* logic into a PythonScript.
DTML is made for generating content but not to implement such
complex logic...and of course the elif part won't work because that's the 
semantic of if-elif.

-aj

--On 2. Dezember 2005 05:37:17 -0700 Christopher Rivard 
<chris at chrisrivard.com> wrote:

> Hello,
>
> I'm am trying to check for the membership of items in a list and think
> I'm missing something.
> How is this done in dtml?
>
> List allids: [15,16,17,18]
>
> Check for multiple items in the list:
>
> <dtml-in allids prefix="loop">
> <dtml-if expr="loop_item == 17">
> something
> <dtml-elif expr="loop_item == 17 and loop_item != 18">
> doesn't work
> </dtml-if>
> </dtml-in>
>
> The goal is to check for combinations:
> 17 and not 18
> 18 only
> 17 only
> 17 and 15
> 18 and 16
> ...combinations.
>
> I don't think that I really want to loop through the list, just want to
> check membership in the list.
>
>
> Thanks in advance,
> Chris
>
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20051202/a7d3ec61/attachment.bin


More information about the Zope mailing list