[Zope] Selecting which objects to loop over
Tue, 17 Jun 2003 19:26:32 +0200
Rafael Cordones Marcos wrote at 2003-6-16 19:14 +0200:
> How do I filter objects in the <dtml-in> tag based on some object property?
> For instance, I want to loop over a set of objects in current directory, like,
> say all DTML Document objects that have an id (name) that begins with "tab-".
> I have tried with:
> <dtml-in expr="objectValues('DTML Document')">
> <dtml-if expr="_.string.find(id, 'tab-') == 0">
> <p>Object title: &dtml-title;</p>
> But I get a
> Error Type: AttributeError
> Error Value: namefind
"id" is a dangerous name. Sometimes, it is a string and
sometimes (in your case) it is a method.
Always use "getId" (which is a method).