Thank you Massimo, It will be much simpler...
:) Richard On Thu, Oct 31, 2013 at 12:43 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > yes. > > where = [(db.auth_user.first_name == 'Jambon'), (db.auth_user.last_name == > 'Forêt Noir')] # etc etc > query = reduce(lambda a,b:a&b, where) > rows = db(query).select() > > > On Thursday, 31 October 2013 11:14:22 UTC-5, Richard wrote: >> >> Hello, >> >> I found this solution : >> >> where_1 = (db.auth_user.first_name == 'Jambon') >> where_2 = (db.auth_user.last_name == 'Forêt Noir') >> where_3 = '' >> where_4 = '' >> where_5 = '' >> where_6 = '' >> >> where_clauses = {'where_1': where_1, >> 'where_2': where_2, 'where_3': where_3, >> 'where_4': where_4, 'where_5': where_5, >> 'where_6': where_6} >> >> where_clauses_list = [] >> for k, value in where_clauses.iteritems(): >> if value: >> where_clauses_list.append(k) >> if len(where_clauses_list) == 2: >> test123 = db(where_clauses[where_**clauses_list[0]] & >> where_clauses[where_clauses_**list[1]]) >> >> >> myselect = test123.select(db.auth_user.**ALL) >> >> But I would like to know it there is a better/simpler way to create a >> db() set for a finite number of where clauses ((db.auth_user.field ...) == >> one where clause) ? >> >> Thanks >> >> Richard >> > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.