-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pulp_href__in filter doesn't handle empty set properly #4437
Labels
Comments
Looks like the problem is with django-filter: carltongibson/django-filter#1609 |
daviddavis
added a commit
to daviddavis/pulpcore
that referenced
this issue
Sep 18, 2023
Fix bug where empty list for the pulp_href__in filter returns all results instead of no results. The problem is that when using FilterMethod, django-filter just simply ignores None and empty set and returns the full list of results: https://github.com/carltongibson/django-filter/blob/e4a70a667a0bf3882fd44b557bc76583d2c65cd1/django_filters/filters.py#L804-L805 There's no way to update the method to prevent this since this logic happens before the method is called. Instead, this change moves the method to the filter and adds a None check. fixes pulp#4437
daviddavis
added a commit
to daviddavis/pulpcore
that referenced
this issue
Sep 18, 2023
Fix bug where empty list for the pulp_href__in filter returns all results instead of no results. The problem is that when using FilterMethod, django-filter just simply ignores None and empty set and returns the full list of results: https://github.com/carltongibson/django-filter/blob/e4a70a667a0bf3882fd44b557bc76583d2c65cd1/django_filters/filters.py#L804-L805 There's no way to update the method to prevent this since this logic happens before the method is called. Instead, this change moves the method to the filter and adds a None check. fixes pulp#4437
daviddavis
added a commit
to daviddavis/pulpcore
that referenced
this issue
Sep 18, 2023
Fix bug where empty list for the pulp_href__in filter returns all results instead of no results. The problem is that when using FilterMethod, django-filter just simply ignores None and empty set and returns the full list of results: https://github.com/carltongibson/django-filter/blob/e4a70a667a0bf3882fd44b557bc76583d2c65cd1/django_filters/filters.py#L804-L805 There's no way to update the method to prevent this since this logic happens before the method is called. Instead, this change moves the method to the filter and adds a None check. fixes pulp#4437
daviddavis
added a commit
to daviddavis/pulpcore
that referenced
this issue
Sep 18, 2023
Fix bug where empty list for the pulp_href__in or pulp_id__in filters return all results instead of no results. The problem is that when using FilterMethod, django-filter just simply ignores None and empty set and returns the full list of results: https://github.com/carltongibson/django-filter/blob/e4a70a667a0bf3882fd44b557bc76583d2c65cd1/django_filters/filters.py#L804-L805 There's no way to update the method to prevent this since this logic happens before the method is called. Instead, this change moves the method to the filter and adds a None check. fixes pulp#4437
daviddavis
added a commit
to daviddavis/pulpcore
that referenced
this issue
Sep 18, 2023
Fix bug where empty list for the pulp_href__in or pulp_id__in filters return all results instead of no results. The problem is that when using FilterMethod, django-filter just simply ignores None and empty set and returns the full list of results: https://github.com/carltongibson/django-filter/blob/e4a70a667a0bf3882fd44b557bc76583d2c65cd1/django_filters/filters.py#L804-L805 There's no way to update the method to prevent this since this logic happens before the method is called. Instead, this change moves the method to the filter and adds a None check. fixes pulp#4437
daviddavis
added a commit
to daviddavis/pulpcore
that referenced
this issue
Sep 18, 2023
Fix bug where empty list for the pulp_href__in or pulp_id__in filters return all results instead of no results. The problem is that when using FilterMethod, django-filter just simply ignores None and empty set and returns the full list of results: https://github.com/carltongibson/django-filter/blob/e4a70a667a0bf3882fd44b557bc76583d2c65cd1/django_filters/filters.py#L804-L805 There's no way to update the method to prevent this since this logic happens before the method is called. Instead, this change moves the method to the filter and adds a None check. fixes pulp#4437
dralley
pushed a commit
that referenced
this issue
Sep 20, 2023
Fix bug where empty list for the pulp_href__in or pulp_id__in filters return all results instead of no results. The problem is that when using FilterMethod, django-filter just simply ignores None and empty set and returns the full list of results: https://github.com/carltongibson/django-filter/blob/e4a70a667a0bf3882fd44b557bc76583d2c65cd1/django_filters/filters.py#L804-L805 There's no way to update the method to prevent this since this logic happens before the method is called. Instead, this change moves the method to the filter and adds a None check. fixes #4437
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We make use of the
pulp_href__in
filter and it works great. We store pulp hrefs for some various things and we can easily look up the resources in pulp using this filter.There is an edge case that I don't think it's properly handling though. It certain cases, the set will be empty and when we pass that to pulp, it seems that all results get returned. I think that no results should instead be returned.
Current behavior:
Expected behavior:
No results (ie
[]
) get returned.The text was updated successfully, but these errors were encountered: