fix: fallback on CursorPagination ordering if unset on the view#8954
Merged
auvipy merged 1 commit intoencode:masterfrom May 2, 2023
Merged
fix: fallback on CursorPagination ordering if unset on the view#8954auvipy merged 1 commit intoencode:masterfrom
auvipy merged 1 commit intoencode:masterfrom
Conversation
* this commit fixes the usage of a CursorPagination combined with a view implementing an ordering filter, without a default ordering value. * former behavior was to fetch the ordering value from the filter, and raises an error if the value was None, preventing the fallback on the ordering set on the CursorPagination class itself. * we reversed the logic by getting first the value set on the class, and override it by the ordering filter if the parameter is present
auvipy
requested changes
Apr 23, 2023
| filter_cls=filter_cls.__name__ | ||
| ) | ||
| ) | ||
| else: |
Collaborator
There was a problem hiding this comment.
else statement block is not needed anymore?
Contributor
Author
There was a problem hiding this comment.
no it's not needed.
previous behavior was:
- get the ordering from the filter if it exists, raises an error if the value is None
- else get the ordering from the instance (self.ordering) and raise an error if None
new behavior is:
- get the ordering from the instance (default case)
- get the ordering from the filter if it exists, override ordering value if it's not None
- raises an error if the ordering variable is None
auvipy
approved these changes
May 2, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
#8953