[Zope] Simple Comparison - How to find the Template you are in in a list of all files in a directory
Clemens Klein-Robbenhaar
zope@zope.org
Thu, 12 Sep 2002 20:56:17 +0200 (CEST)
Hi Edward,
[...]
> I tried this. It did not work. My thoughts are that == would compare
> the pointers to the objects, not the contents.
>
> Code wise, I have this
> <span tal:condition="python:items.title_or_id == template.title_or_id"
> tal:replace="Content I want">Filler</span>
[...]
Ever tried <span tal:content="python:items.title_or_id" />
for You can see what You are comparing? :)
Unlike path notation, python notation does no call the objects
implicitely; thus You compare method objects of different Zope objects;
they are different.
Try:
<span tal:condition="python:items.title_or_id() == template.title_or_id()"
tal:replace="Content I want">Filler</span>
Cheers,
Clemens
P.S.: as You want to compare the objects You could compare quite as
well:
<span tal:condition="python:items.getId() == template.getId()"
tal:replace="Content I want">Filler</span>
or even
<span tal:condition="python:items == template"
tal:replace="Content I want">Filler</span>