because SQLFORM.accepts does alot more meta processing before it passes to FORM.accepts.
-Thadeus On Wed, Jan 27, 2010 at 8:24 AM, mdipierro <mdipie...@cs.depaul.edu> wrote: > Why > > 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)) > > and not > > def test1(): > form=SQLFORM.factory(Field("bool","boolean")) > > if form.accepts(request.vars, session, keepvalues=True): > db.test.insert(bool=request.vars.bool) > > return dict(form=form,list=db().select(db.test.ALL)) > > ? > > Please check the latter, it should work fine. I check why the former > does not. > > > On Jan 27, 1:50 am, Frederik Wagner <fner...@googlemail.com> wrote: > > 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 web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com<web2py%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.