[Zope] Multiple selection property as list
Alexander James Tucker
alex.tucker@totalise.co.uk
Tue, 13 Mar 2001 11:15:07 +0000
Hi,
I have a ZClass based product with a property sheet which has a
multiple selection property called "groups", listing the group or
groups a person belongs to.
I'd like to be able to access this property as a list, so that I can
create expressions like the following:
<dtml-if expr="'Some group' in groups">
...
</dtml-if>
However, in this expression, groups is treated as a string, so I get
an error saying that the left hand side of the 'in' expression must
be a character, not a string.
I can work around the problem by iterating over groups with dtml-in
and creating a new list, something like this:
<dtml-let grouplist="[]">
<dtml-in groups>
<dtml-call "grouplist.append(_['sequence-item'])">
</dtml-in>
<dtml-if "'Some group' in grouplist">
...
</dtml-if>
</dtml-let>
Can anyone see a better way of doing this? If dtml-in can see the
property as a list, why can't the 'in' operator?
Cheers,
Alex.