From f78037c0f33db24c1d84c0231a9721ccb84440f9 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Thu, 19 Apr 2018 13:27:25 -0400 Subject: [PATCH] prevent server error with CT unicode keys --- awx/main/fields.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/main/fields.py b/awx/main/fields.py index b56dcc0e30..9e728053e9 100644 --- a/awx/main/fields.py +++ b/awx/main/fields.py @@ -405,7 +405,7 @@ class JSONSchemaField(JSONBField): error.message = re.sub(r'\bu(\'|")', r'\1', error.message) if error.validator == 'pattern' and 'error' in error.schema: - error.message = error.schema['error'].format(instance=error.instance) + error.message = six.text_type(error.schema['error']).format(instance=error.instance) elif error.validator == 'type': expected_type = error.validator_value if expected_type == 'object': @@ -551,7 +551,7 @@ class CredentialInputField(JSONSchemaField): format_checker=self.format_checker ).iter_errors(decrypted_values): if error.validator == 'pattern' and 'error' in error.schema: - error.message = error.schema['error'].format(instance=error.instance) + error.message = six.text_type(error.schema['error']).format(instance=error.instance) if error.validator == 'dependencies': # replace the default error messaging w/ a better i18n string # I wish there was a better way to determine the parameters of