[Zope] ZPT-How to sort by type and then title or id

Andreas Jung Andreas Jung <andreas@andreas-jung.com>
Thu, 24 Jul 2003 06:22:03 +0200


use sequence.sort() (see Zope API Reference).

-aj

--On Mittwoch, 23. Juli 2003 18:45 Uhr -0500 Jordan Carswell 
<jordan.carswell@hccs.edu> wrote:

> I wanted to create a listing for a folder that sorted first by the type
> of item and secondly by title. I found this example for sorting by title,
> but I can't figure out how to get it to sort by type first. Any guidance
> is appreciated...
>
> <tal:block define="item
> python:here.getFolderContents(suppressHiddenFiles=1); dummy
> python:item.sort(lambda a,b:cmp(a.title_or_id(), b.title_or_id()))"
> tal:repeat="items item">
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )