[Zope] sort in python script dynamically?

Jaroslav Lukesh lukesh at seznam.cz
Fri Jan 9 03:33:42 EST 2004


Paul Winkler wrote:
>>>for i in self.objectItems('Folder').sort(i[0])

>>values = self.objectItems('Folder')
>>values.sort(lambda a,b: cmp(a[0],b[0])
>>for i in values:
>>     # do stuff
>>     pass

This works fine.

> sort() is lexicographic by default, which
> means it already sorts on the first element just fine :-)
> No comparison function needed in this case.
> 

I was try before:

ids = self.objectIds('Folder')
ids = ids.sort()
for i in ids :

TypeError: object of type 'string' is not callable

Regards, JL.





More information about the Zope mailing list