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

rodfersou <[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <[email protected]>
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? Thanks



--
View this message in context: http://plone.293351.n2.nabble.com/plone-app-querystring-Collection-not-filtering-integer-field-tp7573686.html
Sent from the Core Developers mailing list archive at Nabble.com.

------------------------------------------------------------------------------
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
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.