On Friday, November 18, 2011 3:31:21 AM UTC-5, Cahya Dewanta wrote: > > According to the book, for what I understand > > record = db(db.owner.name=='test').select(db.owner.id).first() > could be shortcut with > record = db.owner(id, name='test') > > But the latter return None. How can I shortcut the first statement > properly? > Perhaps the book could be more clear.
record = db.owner(id, name='test') is a shortcut for: record = db((db.owner.id == id) & (db.owner.name == 'test')).select().first() In other words, the first argument to db.owner(...) can simply be the id of the record you want to fetch. It does not represent the name of the field you want to return. Anthony