Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #459 from CSCfi/CSCMETAX-599-allower-projects
Browse files Browse the repository at this point in the history
CSCMETAX-599: [REF] Make allowed_projects handling yet more robust by…
  • Loading branch information
hannu40k authored Jul 1, 2019
2 parents 209b64f + 0505cfa commit 32aed5b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/metax_api/services/common_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,18 @@ def get_list_query_param(request, param_name):
method get_boolean_query_param().
"""
value = request.query_params.get(param_name, None)
if value is not None:
values_list = set( v.strip() for v in value.split(',') )
if values_list:
return values_list
return None

if value is None:
return None
elif value in ('', ','):
return set()

values_set = set( v.strip() for v in value.split(',') )

if values_set:
return values_set

return set()

@classmethod
def create_bulk(cls, request, serializer_class, **kwargs):
Expand Down

0 comments on commit 32aed5b

Please sign in to comment.