Commit 567410a9 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

Corrected `includeDatasetResponses` to accept string parameters

parent 03351ec4
Pipeline #10635 passed with stage
in 57 seconds
......@@ -61,11 +61,12 @@ class Beacon(object):
alleleRequest=query
)
if truthy(query.get('includeDatasetResponses', False)):
should_include_dataset_responses = query.get('includeDatasetResponses', "")
if len(should_include_dataset_responses) and should_include_dataset_responses != "NONE":
response['datasetAlleleResponses'] = []
for r in responses:
response['datasetAlleleResponses'].append(create_beacon_dataset_allele_response_ok(datasetId=r[0],
exists=r[1]))
allele_response = create_beacon_dataset_allele_response_ok(datasetId=r[0], exists=bool(r[1]))
response['datasetAlleleResponses'].append(allele_response)
except (NotImplementedError, Exception) as error:
response = create_beacon_allele_response_error(
beaconId=beacon_id,
......
......@@ -96,11 +96,10 @@ def validate_input(**kwargs):
r'^[AaCcTtGgDd]*$',
True)
whitelist = [True, False, 'true', 'false', 'True', 'False']
if 'includeDatasetResponses' in kwargs and kwargs['includeDatasetResponses'] not in whitelist:
raise APIArgumentError("Invalid {0} ({1}) - {2}".format("includeDatasetResponses",
kwargs['includeDatasetResponses'],
'a boolean was expected'))
wrap('includeDatasetResponses',
'accepts only "ALL", "HIT", "MISS", "NONE" and empty string',
r'^([Hh][Ii][Tt]$)|([Aa][Ll]{2}$)|([Mm][Ii][Ss]{2}$)|([Nn][Oo][Nn][Ee]$)|($)',
True)
return True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment