Skip to content
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

Code should honor empty lists/sets/etc and not treat it as None #1609

Open
daviddavis opened this issue Sep 18, 2023 · 0 comments
Open

Code should honor empty lists/sets/etc and not treat it as None #1609

daviddavis opened this issue Sep 18, 2023 · 0 comments

Comments

@daviddavis
Copy link

daviddavis commented Sep 18, 2023

In the constants file, there is an empty constant that lumps None and other empty values together. Several places use this constant to ignore values when they are None/Empty (e.g. here).

The problem is that when you call /users?id__in= for example, you'd think that no users would be returned. The query is effectively asking for users whose ids are in [] (which is no users). I'd argue that asking for users with id__in=[] is very different than id__in=None since the latter means that no filter was supplied/no filtering is desired. To give an example using django:

In [3]: User.objects.all()
Out[3]: <QuerySet [<User: admin>]>

In [4]: User.objects.filter(pk__in=[])
Out[4]: <QuerySet []>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant