[web2py] Re: Using tuple in db() gives Key Error

2010-10-30 Thread DenesL
In order to get a query object you have to use the field objects and not string representations of them, so you can not do "(db.%s.%s.contains('%s'))" %(filname, term, request.vars[term])) that should be db[filname][term].contains(request.vars[term]) and since queries can be ANDed together, you

[web2py] Re: Using tuple in db() gives Key Error

2010-10-30 Thread mdipierro
Should be querylist = [] for term in request.vars: if term != 'n': querylist.append(db[filename] [term]contains(request.vars[term])) queryterm = reduce(lambda a,b:a&b, querylist) search = db(queryterm).select() queries should not be strings but objects. It works