I'm writing a plugin that needs to work with any arbitrary db table. The 
table name is passed to my controller, and that string (the variable 
'tablename') is used in building a query. I can't just do db.tablename, so 
instead I'm doing db[tablename] and it generally seems to work. But when I 
do db(db[tablename]).select() I don't seem to get a regular row object. In 
particular, recursive selects don't work. So for any linked fields I'm just 
getting the id number of the linked record. The following just throws a key 
error:

for r in rows:
    linked-field-value = r.linkedtable.linkedfield #as per 
http://www.web2py.com/book/default/chapter/06#Recursive-selects

Any suggestions?

Reply via email to