Massimo, could we highlight this issue in the documentation somewhere, 
and/or show the right way to do a compound query. There's no documentation 
on this stuff, it's very easy to accidentally do because won't throw a 
syntax error, and we almost just shipped some production code with 'and' 
instead of &

On Thursday, June 18, 2009 11:43:37 AM UTC-4, mdipierro wrote:
>
> follow up 
>
> query1 or query2 IS INVALID SYNTAX 
> query1|query2 IS CORRECT 
>
> "or" cannot be overwritten in Python so it is still valid but it does 
> not do what you want. 
> query1 or query2 ALWAYS returns just query1. 
>
> Massimo 
>
> On Jun 18, 10:43 am, mdipierro <mdipie...@cs.depaul.edu> wrote: 
> > query1 and query2 IS INVALID SYNTAX 
> > query1&query2 IS CORRECT 
> > 
> > "and" cannot be overwritten in Python so it is still valid but it does 
> > not do what you want. 
> > query1 and query2 ALWAYS returns just query2. 
> > 
> > Massimo 
> > 
> > On Jun 18, 8:58 am, weheh <richard_gor...@verizon.net> wrote: 
> > 
> > > I'm using web2py 1.64.1. I'm seeing a strange behavior in my query. 
> > > I'm trying to isolate a record using a compound "and" clause ... very 
> > > simple stuff: 
> > 
> > >      records = db( (db.x.a == i) and (db.x.b==0) and (db.x.c==None) 
> > > and ...).select(db.x.ALL) 
> > 
> > > But, it returns a whole bunch of records that have nothing to do with 
> > > my match criteria. 
> > 
> > > I redid the search with an "or" clause instead, (don't ask me why I 
> > > did this 'cause it makes no sense to me): 
> > 
> > >     records = db( (db.x.a == i) or (db.x.b==0) or (db.x.c==None) 
> > > or ...).select(db.x.ALL) 
> > 
> > > and believe it or not, this works fine. I think I'm going nuts! Why 
> > > should this work?

-- 



Reply via email to