[Zope] SQL list sorting

Tino Wildenhain tino at wildenhain.de
Wed Jan 21 01:08:22 EST 2004


Hi Tim,

Tim Zegir wrote:
> Hi all,
> 
> I have 2 sqlmethods foo and bar
> 
> then i have a python script 
> 
> -----------------------
> x=int(myx)
> mylist=[]
> 
> for result in context.foo:
> 	mylist.append(result)
> if x == 2:
> 	for result in context.bar:
> 		mylist.append(result)
> return mylist
> -----------------------
> 
> what i want to do is sort this list by a field
> eg. mylist.sort('fieldname')
> but obviously the sort function dose not work like that
> 

as andreas says -> consult python documentation and/or
zope book on sequence.sort()

Otoh, why dont you join (union) the data in the database
and also sort there?

Regards
Tino





More information about the Zope mailing list