mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 19:37:38 -02:30
Make min and max optional in the fields they are used in
This commit is contained in:
@@ -243,19 +243,19 @@ class JobTemplate(UnifiedJobTemplate, JobOptions):
|
|||||||
errors.append("'%s' value missing" % survey_element['variable'])
|
errors.append("'%s' value missing" % survey_element['variable'])
|
||||||
elif survey_element['type'] in ["textarea", "text"]:
|
elif survey_element['type'] in ["textarea", "text"]:
|
||||||
if survey_element['variable'] in data:
|
if survey_element['variable'] in data:
|
||||||
if survey_element['min'] != "" and len(data[survey_element['variable']]) < survey_element['min']:
|
if 'min' in survey_element and survey_element['min'] != "" and len(data[survey_element['variable']]) < survey_element['min']:
|
||||||
errors.append("'%s' value %s is too small (must be at least %s)" %
|
errors.append("'%s' value %s is too small (must be at least %s)" %
|
||||||
(survey_element['variable'], data[survey_element['variable']], survey_element['min']))
|
(survey_element['variable'], data[survey_element['variable']], survey_element['min']))
|
||||||
if survey_element['max'] != "" and len(data[survey_element['variable']]) > survey_element['max']:
|
if 'max' in survey_element and survey_element['max'] != "" and len(data[survey_element['variable']]) > survey_element['max']:
|
||||||
errors.append("'%s' value %s is too large (must be no more than%s)" %
|
errors.append("'%s' value %s is too large (must be no more than%s)" %
|
||||||
(survey_element['variable'], data[survey_element['variable']], survey_element['max']))
|
(survey_element['variable'], data[survey_element['variable']], survey_element['max']))
|
||||||
elif survey_element['type'] == 'integer':
|
elif survey_element['type'] == 'integer':
|
||||||
if survey_element['variable'] in data:
|
if survey_element['variable'] in data:
|
||||||
if survey_element['min'] != "" and survey_element['variable'] in data and \
|
if 'min' in survey_element and survey_element['min'] != "" and survey_element['variable'] in data and \
|
||||||
data[survey_element['variable']] < survey_element['min']:
|
data[survey_element['variable']] < survey_element['min']:
|
||||||
errors.append("'%s' value %s is too small (must be at least %s)" %
|
errors.append("'%s' value %s is too small (must be at least %s)" %
|
||||||
(survey_element['variable'], data[survey_element['variable']], survey_element['min']))
|
(survey_element['variable'], data[survey_element['variable']], survey_element['min']))
|
||||||
if survey_element['max'] != "" and survey_element['variable'] in data and \
|
if 'max' in survey_element and survey_element['max'] != "" and survey_element['variable'] in data and \
|
||||||
data[survey_element['variable']] > survey_element['max']:
|
data[survey_element['variable']] > survey_element['max']:
|
||||||
errors.append("'%s' value %s is too large (must be no more than%s)" %
|
errors.append("'%s' value %s is too large (must be no more than%s)" %
|
||||||
(survey_element['variable'], data[survey_element['variable']], survey_element['max']))
|
(survey_element['variable'], data[survey_element['variable']], survey_element['max']))
|
||||||
@@ -264,10 +264,10 @@ class JobTemplate(UnifiedJobTemplate, JobOptions):
|
|||||||
survey_element['variable']))
|
survey_element['variable']))
|
||||||
elif survey_element['type'] == 'float':
|
elif survey_element['type'] == 'float':
|
||||||
if survey_element['variable'] in data:
|
if survey_element['variable'] in data:
|
||||||
if survey_element['min'] != "" and data[survey_element['variable']] < survey_element['min']:
|
if 'min' in survey_element and survey_element['min'] != "" and data[survey_element['variable']] < survey_element['min']:
|
||||||
errors.append("'%s' value %s is too small (must be at least %s)" %
|
errors.append("'%s' value %s is too small (must be at least %s)" %
|
||||||
(survey_element['variable'], data[survey_element['variable']], survey_element['min']))
|
(survey_element['variable'], data[survey_element['variable']], survey_element['min']))
|
||||||
if survey_element['max'] != "" and data[survey_element['variable']] > survey_element['max']:
|
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)" %
|
errors.append("'%s' value %s is too large (must be no more than%s)" %
|
||||||
(survey_element['variable'], data[survey_element['variable']], survey_element['max']))
|
(survey_element['variable'], data[survey_element['variable']], survey_element['max']))
|
||||||
if type(data[survey_element['variable']]) != float:
|
if type(data[survey_element['variable']]) != float:
|
||||||
|
|||||||
Reference in New Issue
Block a user