Merge pull request #1241 from cclauss/six.string_types_in_mixins.py

six.string_types in mixins.py
This commit is contained in:
Chris Church 2018-02-14 13:38:44 -05:00 committed by GitHub
commit 410111b8c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,7 +199,7 @@ class SurveyJobTemplateMixin(models.Model):
errors.append("'%s' value missing" % survey_element['variable'])
elif survey_element['type'] in ["textarea", "text", "password"]:
if survey_element['variable'] in data:
if type(data[survey_element['variable']]) not in (str, unicode):
if not isinstance(data[survey_element['variable']], six.string_types):
errors.append("Value %s for '%s' expected to be a string." % (data[survey_element['variable']],
survey_element['variable']))
return errors