[Zope] Sorting Zope objects in python scripts

Oleg Broytmann Oleg Broytmann <phd@phd.pp.ru>
Tue, 4 Dec 2001 20:17:24 +0300


On Tue, Dec 04, 2001 at 05:05:17PM +0000, complaw@hal-pc.org wrote:
> If one were to write...
> 
> myList = []
> for obj in context.objectValues(['Folder', 'DTML Document']):
>   if obj.instance_type = 'Desired Class':
>     myList.append(obj)
> 
> .. then I would want to sort the various objects.  The question is, how do I do
> that?
> 
> I could do...
> 
> myList.sort()

   Zope has a special supoprt for sorting. Import "sequence" from DTML and
learn to use it. Search mailing lists for details on Extended DTML Sort.

Oleg.
-- 
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.