If you never used a db backend dealing with NULL values is a little bit
different than dealing with None in python.
While it's true that in python False != None and True != None, it's not the
same in SQL.
As much as the db engine knows, a column with a NULL value has no data to
compare with, so it's impossible to apply a filter to that column.
The only way to filter a NULL value is to use IS NULL (or IS NOT NULL),
which in DAL's case is db.table.field == None (or db.table.field != None).
PS: if you don't want to deal with NULL values in your table definition set
a default
db.define_table('mytable',
Field('myboolean', 'boolean', default=False)
)
so any value inserted with forms or with db.mytable.validate_and_insert()
will use that default if is not explicitely set.
--
---
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/groups/opt_out.