> > db.define_table (person, Field('name'),format='%(name)s') > db.define_table (dog, Field('name'),Field('owner_id',db.person) > > Using this is okay : > db.dog.owner_id.represent=lambda id,row:db.person(id).name > > But using this fails : > db.dog.owner_id.represent=lambda id,row:db.person(id)._format >
_format is an attribute of the db.person table object. However, db.person(id) is a Row object (representing a single record from the db.person table) -- it does not have a _format attribute. Perhaps you are looking for something like this: db.dog.owner_id.represent = lambda id, row: db.person._format % db.person(id ) Anthony