I was looking for know if it was not implemented because it was really more
complex or for some other reasons...

I found myself needing to pass queries trough url and I need to pass
complexe "where clauses" which implies need for () sourrounding some
queries groups...

For now I have this :

from gluon.dal import smart_query

keywords = \
    'table1.f1 = True and ' \
    'table1.f2 != {0}'.format(
        db(db.ref_table.f1 =='Annulé - Void'
           ).select(db.ref_table.id).first().id)

fields = [db.table1.f1,
          db.table1.f2]

active_set = db(smart_query(fields, keywords))

So I can DRYly write db_set and then pass the queries through URL like so :

URL(c='mycontroller', f='myfunc', vars=dict(keywords=keywords))

But, for more complexe "where clause" I am stuck...

I guess passing a web2py query directly into URL vars raise security issue
that why I follow the path of SQLFORM.grid search tool for passing queries
in vars...

QUESTION

Is smart_query() able to parse parenthesis queries some how?

Richard


On Wed, Apr 29, 2015 at 10:37 AM, Niphlod <niph...@gmail.com> wrote:

> is it something that requires an answer ? grid search is meant to be
> flexible AND user-friendly: you can come up with your own syntax and code
> your own search widget if you need something else....
>
>
> On Wednesday, April 29, 2015 at 3:49:37 PM UTC+2, Richard wrote:
>>
>> Hello,
>>
>> It seems that SQLFORM.grid search tool not accept parenthesis?
>>
>> Ex.:
>>
>> Not possible
>>
>> (table.input_comment = "" or table.input_comment != None) and ...
>>
>> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to