[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:11:22 -0600


I have a simple Python script that returns a list of files in a 
directory. This is used on a page template to create a list of links to 
all sibling files in the folder. This is very similar to one of the 
Zope examples.

However I can't delete the current context from the list as I want it 
included, just displayed differently. The Python script sorts the 
objects by a required criteria to determine their order in the list, so 
manually reintroducing the current context in the template is not 
possible.

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?

Thanks,

Edward