On Monday, January 2, 2017 at 1:36:59 PM UTC-5, Dave S wrote:
>
> I have a controller with
>
>  r = db(db.mytable.PostDate is not None)
>

The above is not a valid DAL query. It is literally equivalent to:

db(True)

Instead, you must use Python logical operators, as specified in the DAL 
documentation:

db(db.mytable.PostDate != None)

The presence of the Field object in the above expression overrides the 
usual behavior of the "!=" operator, returning a DAL Query object rather 
than a Python boolean value. In your original query, there is no overriding 
of "is not", so you simply get back a boolean True value (as the Field 
object itself is not None).

Anthony

-- 
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.

Reply via email to