Skip to content

Commit

Permalink
repurpose parameter_as_list
Browse files Browse the repository at this point in the history
  • Loading branch information
oboratav committed Oct 31, 2020
1 parent bee0f3a commit 404a358
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ def extract_credentials(encoded_string: str) -> tuple:

def parameter_as_list(parameter) -> list:
"""
If a query parameter is repeated, falcon returns it as a list.
If it isn't repeated, falcon returns it as a string. This function
simplifies this behaviour by converting everything into a list.
If the parameter object is a list, return it as is. If it's a
string or dictionary, return it enveloped in a list.
"""
if type(parameter) == list:
return parameter
elif type(parameter) == str:
elif type(parameter) in (str, dict):
return [parameter]

def generate_special_field(**kwargs) -> str:
Expand Down

0 comments on commit 404a358

Please sign in to comment.