ZPT-How to sort by type and then title or id
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">
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 )
Hi, I am trying to make a ZClass for an research ethics committee. In the zProject class I have added a property sheet including a selection for projectType value = projectTypes and added a lines property in the root folder "projectTypes" with the values. A combox comes up in the zclass property sheet with the right values from the root/lines propperty but when I add a property sheet interface I get a error mesage: Error Type: AttributeError Error Value: read When I delete the projectType property, adding a property sheet interface works. I have tried putting the projectTypes lines property in various places without a change. Any suggestions as tto what I should try next? david
David Little wrote at 2003-7-24 20:07 +0100:
I am trying to make a ZClass for an research ethics committee. In the zProject class I have added a property sheet including a selection for projectType value = projectTypes and added a lines property in the root folder "projectTypes" with the values.
A combox comes up in the zclass property sheet with the right values from the root/lines propperty but when I add a property sheet interface I get a error mesage: Error Type: AttributeError Error Value: read When I delete the projectType property, adding a property sheet interface works.
That's very strange. There should be no "read" involved. Can you look at the traceback, please. When you do not understand it, please post it. However, I will soon be out of town for several weeks. Probably, others need to help you. Dieter
participants (4)
-
Andreas Jung -
David Little -
Dieter Maurer -
Jordan Carswell