[Zope-CMF] Sorting objects by specific variable

Gitte Wange gitte@mmmanager.org
Wed, 7 May 2003 12:41:38 +0200


On Wednesday 07 May 2003 11:58 am, Gitte Wange wrote:
> Hello,
>
> I have tried searching the archives for an answer, but did not find
> anything ... so here goes:
>
> How do I sort objects by a specific variable ?

I found an old posting giving this solution:
-------------------------------------------------------------------------
##parameters=pType,alphaBy

objects = context.contentValues(filter={'portal_type':pType})

sequence.sort(raw_items, ((alphaBy, 'cmp', 'asc'),))

return objects
-------------------------------------------------------------------------

But it doesn't seem to sort anything :-(

-- 
Gitte Wange
Technical Manager

Email: gitte@mmmanager.org
Web: http://www.mmmanager.org
Tlf: +45 36 46 20 02

Python 2.0 beta 1 is now available from BeOpen PythonLabs.
There is a long list of new features since Python 1.6,
released earlier today. We don't plan on any new releases
in the next 24 hours.

    -- Jeremy Hylton, in the 2.0b1 announcement, 5 Sep 2000