[Zope] Sorting a dictionary in ZPT

Richard Wesley hawkfish@trustedmedianetworks.com
Tue, 11 Feb 2003 09:54:20 -0800


I have a list of dictionaries extracted from a database by a python 
script.  I would like to sort them for display in a ZPT.  When I try 
to say something like

tal:define="raw python:here.rawScript();
cooked python:sequence.sort(raw,(('title','nocase','asc'),));"

I get the rather annoying error message:

Error Type: TALESError
Error ValueL exceptions.AttributeError on 'None' object has no 
attribute 'lower' in <PythonExpr 
sequence.sort(raw,(('title','nocase','asc'),))>, at line...

The dictionaries all have a 'title' entry (I checked) so it looks 
like sequence.sort has some sort of requirements for its data list.

Is there a better way to do this?

TIA,

- rmgw

<http://www.trustedmedianetworks.com/>

----------------------------------------------------------------------------
Richard Wesley                                  Trusted Media Networks, Inc.

"...if you can't get out, you just either blow something up, or you eat
  something, or you just throw penguins in the air."
                                              - Brian Henson