Hi all : The below code snippet in web2py manual (p. 340), isn't resulting 
to the expected output.
def list_records():
  table = request.args(0)   #returns db
  query = request.vars.query #db.dog.owner == 1
  records = db(query).select(db[table].ALL)  # db("...") requires 
"owner==1" as parameter
  return dict(records=records) 

This seems to work:

def list_records():
  table = request.args(1)
  query = request.vars.query.split('.')[-1]
  records = db(query).select(db[table].ALL)
  return dict(records=records)

-- 



Reply via email to