You are missing some brackets. This will work: db((db.friends.user1 == session.email)|(db.friends.user2 ==session.email)).select()
except on GAE. GAE does not support OR. Massimo On Dec 1, 8:24 pm, WK <[EMAIL PROTECTED]> wrote: > Hello, > I am new to web2py and found it quite impressive. I have one question > though: How do you do OR? ex/ > > db((db.friends.user1 == session.email | db.friends.user2 == > session.email)).select() > > I want to select to get all entries where user1 is email or user2 is > email but it gives me TypeError: unsupported operand type(s) for |: > 'str' and 'SQLField'. > > I tried OR but that doesn't work by python's definition of OR and will > only run the first part. > > Is there a clever way to do this? > > Which is better: > * Make a big select and just run through it to find where user1 or > user2 is email > * make 2 query calls and append them to array > > NOTE: I am testing web2py on GAE. > > Thanks! > WK --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

