[plone.app.querystring] Collection not filtering integer field

Rodrigo Ferreira de Souza <[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <CAOdJJ2dZJUYNcyahT_e_DQht2+JiDXN-3wm5_17NTuRuvH+cPQ@mail.gmail.com>
I have an integer field and when I try to create a filter on it it didn't
work.

Looking at p.a.querystring code I see that the related operators don't work:


   - plone.app.querystring.operation.int.is
   - plone.app.querystring.operation.int.lessThan
   - plone.app.querystring.operation.int.largerThan

They are mapped to these methods respectively:

   - plone.app.querystring.queryparser._equal
   <https://github.com/plone/plone.app.querystring/blob/1052e94636eaf750c747d619c730adaf45ef2082/plone/app/querystring/queryparser.py#L64>
   - plone.app.querystring.queryparser._lessThan
   <https://github.com/plone/plone.app.querystring/blob/1052e94636eaf750c747d619c730adaf45ef2082/plone/app/querystring/queryparser.py#L96>
   - plone.app.querystring.queryparser._largerThan
   <https://github.com/plone/plone.app.querystring/blob/1052e94636eaf750c747d619c730adaf45ef2082/plone/app/querystring/queryparser.py#L86>

And these methods don't convert the value to int (because they are used for
other string based types).

Also I tested the plone.app.querystring.operation.selection.is and it fail
too with an int field.

Looking at the tests of these methods
<https://github.com/plone/plone.app.querystring/blob/1052e94636eaf750c747d619c730adaf45ef2082/plone/app/querystring/tests/testQueryParser.py#L247>,
you clearly see that it is not testing every kind of data.

My suggestions are to create new methods just for int fields (doing type
cast) and to add a new operator for int fields
plone.app.querystring.operation.intselection.is (something like this)

Can someone confirm this as a bug?

Since now thanks,
Rodrigo Ferreira de Souza

python -c "n='H+6(13+zT5((51(9z65zG+%
9';s=len(n)-1;i=list(range(s+1))[::-1]+list(range(1,s+1));print('\n'.join(['
'.join([chr(154-ord(n[(x if x > y else y)])) for y in i]) for x in i]))"

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y

_______________________________________________
Plone-developers mailing list
Plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/plone-developers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.