one should work. They should be This compute works: db.item.result.compute = lambda r: r.a + 1 This one does not: db.item.result.compute = lambda r: r.b + 1
The former works because there must be a global variable a defined somewhere which means you are getting wrong results. On Aug 3, 8:44 pm, pbreit <pbreitenb...@gmail.com> wrote: > A gotcha when working with computed fields and update_record: the only > fields that get sent to the compute function are the ones specified in the > update_record. This makes sense but caught me off guard. > > Example: > > item.update_record(a=1) > > This compute works: > db.item.result.compute = lambda r: a + 1 > > This one does not: > db.item.result.compute = lambda r: b + 1