Hi! I am angry, I wasted half a day to catch this error: db.define_table('tbl', Field('name'), Field.Virtual('alias_name', lambda row: row.name) # right notation is `row.tbl.name` )
in controller: rows = db(db.tbl).select() #it's OK! It doesn't cause any error, it returns rows! #but when you try to: print rows[0].alias_name # it causes error, because there isn`t any key/attribute like `alias_name` So, how can I detect that error in Field.Virtual? What happens if for one of the rows Field.Virtual returns something like above? It won't have this field? - yes! I spent some tests and catch, that: Field.Virtual('alias_name', lambda row: 1/0) # causes an error when select()! - expected but Field.Virtual('alias_name', lambda row: row. *neverhood_will_be_processed_without_any_errors*) # but row won't have ` *neverhood**...*` -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.