[Zope] title property/function

Laurie Nason laurien@blake.3dem.bioch.bcm.tmc.edu
Fri, 19 Oct 2001 15:29:16 -0500


OK guys - here's the problem....
I have a number of ZClasses, each one has a title property that is actually
a function and pulls information from other properties of the ZClass. I want
to use this property to sort my tree object. So being the python genius that
I am not - I have created a python script to return the branches in the
correct order sorted by title.

# This is the code that returns objects for the tree view

con=context
return_object=[]

for obj in con.objectValues(['Folder','Group', 'Project', 'Micrograph',
'Microscopy', 'Scan', 'Purification', 'Aliquot', 'Freezing', 'Progress',
'Publication', 'Reference', 'Reconstruction', 'Structure', 'CCD']):
    return_object.append(obj)

return_object.sort(lambda a,b:a.title<b.title)
return return_object

However, this code does not evaluate the title - but simply returns the
dtml-if statement and sorts on that.... not what I want!

Any ideas?

Laurie

Laurie Nason
Baylor College of Medicine
Houston TX USA