Relax type checking requirements for floats since javascript passively

converts whole number floats to ints
This commit is contained in:
Matthew Jones 2014-10-14 15:41:22 -04:00
parent c43a7be99e
commit 21e4afca14

View File

@ -270,8 +270,8 @@ class JobTemplate(UnifiedJobTemplate, JobOptions):
if 'max' in survey_element and survey_element['max'] != "" and data[survey_element['variable']] > survey_element['max']:
errors.append("'%s' value %s is too large (must be no more than%s)" %
(survey_element['variable'], data[survey_element['variable']], survey_element['max']))
if type(data[survey_element['variable']]) != float:
errors.append("Value %s for %s expected to be a float" % (data[survey_element['variable']],
if type(data[survey_element['variable']]) not in (float, int):
errors.append("Value %s for %s expected to be a numeric type" % (data[survey_element['variable']],
survey_element['variable']))
elif survey_element['type'] == 'multiselect':
if survey_element['variable'] in data: