[Zope] Sorting objectValues in Python Script

Jerome Alet alet@librelogiciel.com
Fri, 18 Oct 2002 10:24:24 +0200


On Fri, Oct 18, 2002 at 10:20:27AM +0200, Jerome Alet wrote:
> On Fri, Oct 18, 2002 at 10:15:10AM +0200, Andreas Tille wrote:
> > Hello,
> > 
> > I just want to build a sorted list of
> > 
> >    list = context.objectValues('ExtFile')
> >    for file in list:
> >         print file.id, file.title
> >    return printed
> 
> <UNTESTED>
> list.sort(lambda x,y : cmp(y.getId(), x.getId()))
> </UNTESTED>

Sorry I think this won't work in a Python Script because IIRC
lambda is forbidden there.

Replace the lambda with a normal function and it should be ok.

Jerome Alet