[Zope] sequence.sort on a property of contained objects

Hong Yuan obichina at 21cn.com
Sat Oct 9 10:39:59 EDT 2004


Andreas Jung wrote:

>
>
> --On Samstag, 9. Oktober 2004 22:13 Uhr +0800 Hong Yuan 
> <obichina at 21cn.com> wrote:
>
>>
>> I try to use the following code to sort the folders:
>> <ul tal:define="folders here/get_folders;
>>                   sort_on python:(('property/menu_order', 'cmp', 
>> 'asc'),);
>>                   sorted_folders python:sequence.sort(folders, 
>> sort_on)">
>>
>> But it seems the sort condition can not contain path expression to 
>> access
>> 'property/menu_order'.
>
>
> I have no idea why you think that you could use path expression at 
> that point. The
> documentation of sequence.sort() does not tell you about using path 
> expressions.
>
> Andreas
>
>
I was a little bit confused about the difference beteween an attribute 
of an object per se and the path expression to get the attribute. So 
that means that sequence.sort() can only take in an attribute of an 
object as the sort key and not an attribute of an attribute. It seems 
that there is not short to do the desired sort in ZPT only, but that I 
have to write my own sort function in python. Is this correct?

Best Regards,
Hong Yuan


More information about the Zope mailing list