Repository navigation
service: emit ge/le for the __range filter lookup - #322
VitorCoelho wants to merge 6 commits into
Conversation
Signed-off-by: VitorCoelho <vitorc195@gmail.com>
|
Hi @VitorCoelho thanks for the PR. I have been curious how something that is not Odata protocol ended in - and it seems it is from #113. If I understood the change correctly, we have the "gte/lte" wrong from Odata filter expression, but tailored for Django filtering - so for better or worse, already six years this is a stable feature in pyodata for anybody who uses pyodata + django together. Direct merging of this PR as is would be a breaking change for that - that would not be nice to debug on that code side. I agree we should be adhering to odata specification first and generate |
|
I am converting to draft directly due that, so even when all build passes this is not merged accidently at the moment. |
|
@phanak-sap thanks for looking into the history, that makes sense, and I agree a silent change of the generated URL would be unpleasant for anyone relying on it. One thing I noticed while tracing it: in the same change (#113) the single lookups Would one of these work for you?
I'll be happy to implement your preference, with tests for both settings. |
I did not have time to read properly the code, just noted the history and PR #113. Yes, 'lte' and' gte' filter expression creates correct URL snippet, while range not. I see it in current HEAD. Your fix is therefore correct, just nobody reported a bug yet (not using "range" at all it seems). If the URL is rejected by server since not OData compliant, that's a valid bugfix and no Config nor deprecation warning is needed. On other hand, that also means that Odata VALID It could be then thought later how to split "Odata only" filtering from "Django style" and from "hypothetical third ORM filtering flavor", if that need arises. Does that make sense to you? Feel free to point out problem directly. |
The chainable filter only knew the Django-style lookups __lte / __gte. Accept the OData operator names __le / __ge as well, so a filter can be written from the OData specification without knowing the Django names. Signed-off-by: VitorCoelho <vitorc195@gmail.com>
Signed-off-by: VitorCoelho <vitorc195@gmail.com>
Signed-off-by: VitorCoelho <vitorc195@gmail.com>
|
Thanks, that makes perfect sense, and good to know the Config option isn't needed. I added Please feel free to mark it ready for review when you're happy with it. I'll stop bothering you on plain Sunday :P |
no problem, no bothering. It is up to me when I check PRs :D |
Looks good on the quick pass now, new relevant tests added, existing modified just for the fix part, I will look for sure tomorrow after sleep just to be extra sure, but this is heading to be part of next bugfix version. |
|
@VitorCoelho Huh? Its gone? This was not yet merged.. |
What
GetEntitySetFilterChainabletranslated the__rangelookup into the operatorsgte/lte:Why
OData has no
gte/lteoperators. The comparison operators areeq,ne,gt,ge,lt,le(OData v2 URI conventions, 4.5 Filter System Query Option), so a service rejects the generated$filterwith a syntax error. The__gte/__ltelookups already emitge/le;__rangenow does the same.How it was tested
__rangeasserted the invalid URL. I updated them to the correct one: they fail onmasterand pass with the fix.pytest: 298 passed.