[web2py] db.table.update(f1='...') fine, but why I can't pass a dict : db.table.update({'f1':'...'})

2012-04-03 Thread Richard
Hello, I would like to update some field with the out put of a web2py query that I can transform as dict like this : db(...).select(db.table1.field1, db.table1.field2).first().as_dict() Then I would do that : db(...).update(db(...).select(db.table1.field1, db.table1.field2).first().as_dict())

Re: [web2py] db.table.update(f1='...') fine, but why I can't pass a dict : db.table.update({'f1':'...'})

2012-04-03 Thread Bruno Rocha
You have to unpack the dict db.table.insert(**dict) dbset.update(**dict) In python ** unpack dict key/value Also if you want to filter the valid fields you can use the db.table.insert(**db.table._filter_fields(dict)) On Tue, Apr 3, 2012 at 12:26 PM, Richard wrote: > Hello, > > I would like t

Re: [web2py] db.table.update(f1='...') fine, but why I can't pass a dict : db.table.update({'f1':'...'})

2012-04-03 Thread Richard Vézina
Ho! Thanks... Richard On Tue, Apr 3, 2012 at 11:47 AM, Bruno Rocha wrote: > You have to unpack the dict > > db.table.insert(**dict) > > dbset.update(**dict) > > In python ** unpack dict key/value > > Also if you want to filter the valid fields you can use the > > db.table.insert(**db.table._fi