[web2py] Re: update a field from a record from a table given all as parameters

2011-06-24 Thread Massimo Di Pierro
I should have added a return def update_my_field(tablename, columnname, id,value): return db(db[tablename].id==id).update(**{columnname:value}) and I did it because this fails more gracefully if the id is not found (returns 0). On Jun 24, 4:35 pm, Anthony wrote: > Note, Massimo used db(db[t

Re: [web2py] Re: update a field from a record from a table given all as parameters

2011-06-24 Thread Anthony
Note, Massimo used db(db[tablename].id==id), which is a Set object (not a Row object), so the update method is appropriate. On Friday, June 24, 2011 5:25:20 PM UTC-4, sebastian wrote: > I do not understand it, but it works ! (in the book says to do not confuse > update with update_record becau

Re: [web2py] Re: update a field from a record from a table given all as parameters

2011-06-24 Thread Sebastian E. Ovide
I do not understand it, but it works ! (in the book says to do not confuse update with update_record because for a single row, the method update updates the row object but not the database record, as in the case of update_record) Thanks ! On Fri, Jun 24, 2011 at 9:24 PM, Massimo Di Pierro < mass

[web2py] Re: update a field from a record from a table given all as parameters

2011-06-24 Thread Massimo Di Pierro
def update_my_field(tablename, columnname, id,value): db(db[tablename].id==id).update(**{columnname:value}) update_my_field("my_table","my_column","123","hello world") On Jun 24, 3:08 pm, "Sebastian E. Ovide" wrote: > Hi All, > > how can I do something like this: > > def update_my_field(tabl