[Zope] trying to use hasProperty()
Dieter Maurer
dieter@handshake.de
Thu, 21 Feb 2002 21:47:35 +0100
Roger Sillito writes:
> Hello,
> I'm trying to iterate through an list created with ObjectItems and test
> if each sequence item has a given property, something like:
>
> <dtml-in "objectItems(['DTML Document'])">
> <dtml-if "_['sequence-item'].hasProperty('active')">
> <p>This document is "active"</p>
> </dtml-if>
> </dtml-in>
>
> This isn't working though, I get
>
> Error Type: AttributeError
> Error Value: hasProperty
"_[...]" renders the object. This process often results in a string
and strings do not have a "hasProperty" attribute.
Use "_.getitem(...)" instead.
More about such issues in the "Name lookup" section of
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
Dieter