I can't reproduce this with 1.91.6 nor 1.92.1, both show r.f3 as int.
On Mar 5, 4:19 am, imm <ianmm...@googlemail.com> wrote: > Hi, I'm using Version 1.91.6 (2011-01-03 17:55:14) and I'm find this > behaviour with computed fields. > > Is correct, is the type of a computed field always a string? > > Example: > > *Define a table with a computed field:* > > db.define_table('entries', > Field <http://127.0.0.1:8080/examples/global/vars/Field>('f1', 'integer'), > Field <http://127.0.0.1:8080/examples/global/vars/Field>('f2', 'integer'), > Field <http://127.0.0.1:8080/examples/global/vars/Field>('f3', 'integer', > compute=lambda r: r['f1'] * r['f2'])) > > *Insert some data:* > > db.entries.insert(f1=9, f2=8) > > *Show data and type:* > > >>> for r in db(db.entries).select(): > > ... print r.f1, type(r.f1) > ... print r.f2, type(r.f2) > ... print r.f3, type(r.f3) > ... > 9 <type 'int'> > 8 <type 'int'> > 72 <type 'str'> > > Thanks - Ian