fix KeyError with spec

This commit is contained in:
Wayne Witzel III
2017-01-24 16:53:48 -05:00
parent fba1fa83d0
commit df9bb829fc

View File

@@ -2421,7 +2421,7 @@ class JobTemplateSurveySpec(GenericAPIView):
raise LicenseForbids(_('Your license does not allow '
'adding surveys.'))
survey_spec = obj.survey_spec
for pos, field in enumerate(survey_spec['spec']):
for pos, field in enumerate(survey_spec.get('spec', [])):
if field.get('type') == 'password':
if 'default' in field and field['default']:
field['default'] = '$encrypted$'