Code should honor empty lists/sets/etc and not treat it as None
daviddavis opened this issue · 0 comments
daviddavis commented
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 []>