On Wednesday, October 26, 2011 12:21:33 PM UTC-4, Archibald Linx wrote: > > Thank you Anthony ! > > Is the length "len" always defined in Python ? >
No, I think the len() function will fail if you pass None to it, so if you were using request.vars, you'd want something like: default=len(request.vars.to) if request.vars.to is not None else [whatever you want the default to be otherwise] > > I couldn't find much tools in the documentation to query lists of > references apart from the "contains" operator. > > For example, let's have the following "message" table : > id / to / status > 1 / steve,jimmy / 0,2 > 2 / john,julia / 1,2 > 3 / julia,peggy / 0,1 > > I want to get the rows where "Julia" is in "to" and where her status > is "0" (in this particular case, that is row n°3). > With the "contains" operator I only know how to get the rows where > "Julia" is in "to" (that is row n°2 and n°3). > > Should I write raw SQL ? > How would you write it in raw SQL?