Does form.vars include all the variables needed by the compute function? Also, instead of:
**{f: v for f, v in form.vars.iteritems()} you can do: **db[request.args(0)]._filter_fields(form.vars) _filter_fields will filter out the "id" field as well as any form.vars that are not fields in the table. Anthony On Wednesday, March 4, 2015 at 4:35:37 PM UTC-5, Richard wrote: > > Hello, > > I need to do control record update in order to clear some fields values in > case a flag is set to false. But doing the update like this : > > > db(db[request.args(0)].id == request.args(1)).update(**{f: v for f, v in > form.vars.iteritems()}) > > prevent a compute field to be trigger and updating properly as well... > > So, to make sure my compute field get it I am doing another update() like > this > > > db(db[request.args(0)].id == request.args(1)).update() > > > Which work in one case by not in the other where I actually clear some > values like this : > > > db(db[request.args(0)].id == request.args(1)).update(f1=None, f2=None, **{ > f: v for f, v in form.vars.iteritems() if f not in ('f1', 'f2')}) > > > Maybe I should do a db.commit() before my second "blank" update() though > it seems to me that it should be a better way and I am concern in reducing > db hit. > > Thanks > > Richard > > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.