[Zope] SQL list sorting

Dieter Maurer dieter at handshake.de
Wed Jan 21 14:53:04 EST 2004


Tim Zegir wrote at 2004-1-21 16:04 +1100:
>I have 2 sqlmethods foo and bar
>
>then i have a python script 
>
>-----------------------
>x=int(myx)
>mylist=[]
>
>for result in context.foo:

Are you sure, this does work?

  You say above "foo" is an Z SQL Method.
  A Z SQL Method is not a sequence and your cannot iterated over it.
  You must apply it to get a sequence as result.

> ...
>what i want to do is sort this list by a field
>eg. mylist.sort('fieldname')

You want to look at the "sequence.sort" documentation...

-- 
Dieter



More information about the Zope mailing list