with that query you get None or False for both promo and closed. What do you want ?
On Monday, March 9, 2015 at 8:27:27 PM UTC+1, Dmitry Ermolaev wrote: > > not work: > for pr in db((db.progs.promo.belongs((None, False))) & > (db.progs.closed.belongs((None, False)))).select(): > > work: > for pr in db(db.progs).select(): > if pr.promo or pr.closed: continue > > > понедельник, 9 марта 2015 г., 16:58:26 UTC+3 пользователь Niphlod написал: >> >> for the same exact reason. >> >> NOT field = True >> >> in t-sql means just FALSE, not FALSE and NULL >> >> On Monday, March 9, 2015 at 2:37:46 PM UTC+1, Dmitry Ermolaev wrote: >>> >>> I use negate - why this not worked? >>> >>> воскресенье, 8 марта 2015 г., 23:15:49 UTC+3 пользователь Niphlod >>> написал: >>>> >>>> booleans in T-SQL are not treated the same way as python..... in T-SQL, >>>> NULL values are neither True or False, they are just NULL. >>>> >>>> So, if you want closed either None or False, you should do >>>> >>>> ((db.progs.closed == None) | (db.progs.closed == False)) >>>> >>>> one shortcut to it would be >>>> >>>> db.progs.closed.belongs((None, False)) >>>> >>>> that'll turn this syntax to the previous one, effectively selecing both >>>> None and False values. >>>> >>>> On Sunday, March 8, 2015 at 7:23:54 PM UTC+1, Dmitry Ermolaev wrote: >>>>> >>>>> db((db.progs.promo==True) & (db.progs.closed!=True)).select(): >>>>> or >>>>> db((db.progs.promo==True) & ~(db.progs.closed==True)).select(): >>>>> >>>>> >>>>> not worked (( >>>>> if exist record wirh promo=True and closed=None or False - it not >>>>> selected! >>>>> >>>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

