[Zope] Simple Comparison - How to find the Template you are in in a list of all files in a directory

Edward Pollard pollej@uleth.ca
Thu, 12 Sep 2002 11:51:45 -0600


On Thursday, September 12, 2002, at 11:39 AM, Passin,Thomas B. (Tom) 
wrote:

> [ Edward Pollard]
>>
>> I've been attempting to iterate through the list and then compare the
>> file ID of the item in the repeat loop with the file ID of
>> the template
>> using 'cmp'. I cannot get cmp to return 0 even when the names are the
>> same (as evaluated by displaying them in the template).
>>
>> Is this the incorrect way to compare strings? Is there a
>> better way to
>> do this?
>>
>
> if a==b: #do something
>

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>

items being the list I'm iterating through.

So the obvious (==) didn't work (apologies for not clarifying this in 
the first place), the next-obvious (cmp) didn't work, what will?

Edward