Hi .*,
it seems to me that there is a bug saving boolean fields with
SQLFORM.factory forms.
If I define a boolean field in a table and use the standard SQLFORM to
make an input form, the accept function will save 'T' of 'F' to the
DB.
Whereas in the case where I create a form with SQLFORM.factory, do a
FORM.accept and an explicit db.insert, instead of 'F' there will be a
NULL on the DB.
Here a test setup:
DB:
db.define_table('test',Field('bool','boolean'))
CONTROLLER:
def test1():
form=SQLFORM.factory(Field("bool","boolean"))
if FORM.accepts(form, request.vars, session, keepvalues=True):
db.test.insert(bool=request.vars.bool)
return dict(form=form,list=db().select(db.test.ALL))
def test2():
form=SQLFORM(db.test)
if form.accepts(request.vars, session, keepvalues=True):
response.flash = 'done'
return dict(form=form,list=db().select(db.test.ALL))
test1 gives 'True' ('T') and 'None' (NULL) and test2 'True' ('T') and
'False' ('F').
A bug or my problem? :-)
Bye
Frederik
--
You received this message because you are subscribed to the Google Groups
"web2py-users" 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.