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 with strings but
it going away with the new DAL. The book does not say you can do that.

On 30 oct, 16:01, thylacine222 <[email protected]> wrote:
> Hi, I'm running this code right now:
>     querylist = []
>     for term in request.vars:
>         if term != 'n':
>                querylist.append("(db.%s.%s.contains('%s'))" %
> (filname, term, request.vars[term]))
>     queryterm = (' & '.join(querylist),)
>     search = db(*queryterm).select()
>
> The term in queryterm works perfectly if I use it manually on the
> database administration page, but when I run this code, I get "Key
> Error:foo" where foo is a field that I'm querying.
>
> Is there any easier way to do this? I'm not sure why I keep getting
> this error.

Reply via email to