Hi community,
I'm working with web2py, again. :-)
It took me hours today to realize validate_and_insert(field1=value1,
field3=value3, ...) only works for the fields appears, but not for those
absent. Is this a expected behavior or is it considered a bug?
See example.
# -*- coding: utf-8 -*-
db.define_table('my_table',
Field('foo', requires=IS_NOT_EMPTY()),
Field('bar', requires=IS_NOT_EMPTY()),
)
def index():
# r = db.my_table.validate_and_insert(foo='hello', bar='world') #
Pass. Of course
# r = db.my_table.validate_and_insert(foo='hello', bar=None) #
Refused. As expected.
r = db.my_table.validate_and_insert(foo='hello') # This one got
PASSED?!
if r.id:
return {'message': 'Created #%d' % r.id}
else:
return {'message': 'err: %s' % r.errors}
Problem can be reproduced on web2py 2.4.6 and 1.99.4
Thanks in advance.
--
---
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.