[Zope] Sort DateTime objects?

Dieter Maurer dieter@handshake.de
Fri, 8 Nov 2002 23:11:47 +0100


Jim Kutter writes:
 > I have a product with a class that contains a DateTime object with the name
 > datetime (I know, bad choice, but the choice has been made...)
 > 
 > So I want to sort a collection of these objects by ascending date.  So I get
 > all objects of that type into a list called "events" then use the sequence
 > module
 > 
 > So this is my basic logic -
 > sorted = sequence.sort(events, (('datetime.x()', 'cmp', 'asc'),))
                                     ^^^^^^^^^^^^
This must be the name of an attribute or parameterless method,
not the method call itself. Use "x" alone.


Dieter