Thank you very much Anthony for your detailed explanation. I didn't realize the db select returns a Rows object. Your solution worked!
Thank you. On Sunday, May 20, 2012 11:03:33 PM UTC+9, Anthony wrote: > > I'm trying to pass a SELECT as follows: >> def showToolEntries(): >> if request.args(0) in ToolsDB.tables: >> return dict(entries=SELECT("Select from list", operationalToolsDB >> ().select(ToolsDB[request.args(0)].serial_number))) >> > > SELECT() takes either a list or a set of positional arguments. Since you > passed "Select from list" as the first argument, it takes the result of > your db select (which is a Rows object) as a positional argument and puts > it all in a single <option> element. The Rows object is serialized into an > HTML table, which apparently the browser compresses to a single row. > Instead, try something like this: > > SELECT("Select from list", > *[r.serial_number for r in ToolsDB().select(ToolsDB[request.args(0)]. > serial_number)]) > > Anthony >