I believe that as 'and' is a python keyword it cannot be used for DAL in that way. You may be right about an error message. However, perhaps some developers rely on a python 'and' in a query (but don't ask me for an example!.
-D On Feb 17, 6:00 pm, Paul Gerrard <p...@gerrardconsulting.com> wrote: > On more than one occasion, I've been caught out by a slip in my select > statements. If you use 'and' rather than '&' to combine criteria for a > select you get different results. In the first case, (and) the code > returns a single record, regardless of the values of the critieria > used for the selection. In the second case (&) I get the correct > record depending on the value of termkey. > > # this doesn't work > # > glossary=db((db.glossaryterms.termkey==termkey) and > (db.glossaryterms.org_id==session.org_id)).select() > # > # this does work > glossary=db((db.glossaryterms.termkey==termkey) & > (db.glossaryterms.org_id==session.org_id)).select() > > My question is: should using 'and' work at all or is it precluded as a > keyword in queries? As it is I've lost hours trying to figure out the > problem. > > If 'and' should work - there's a bug in DAL I think. > If 'and' should not work, then it would be really helpful if the DAL > rejected with a runtime failure message so it doesn't waste a lot of > time.