From 9f6a4e135f57bd6ae267ce73956685927a93238b Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Thu, 19 Apr 2018 14:25:59 -0400 Subject: [PATCH] fix server error with unicode in template --- awx/main/fields.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/awx/main/fields.py b/awx/main/fields.py index 9e728053e9..3ba1e4aed6 100644 --- a/awx/main/fields.py +++ b/awx/main/fields.py @@ -9,7 +9,7 @@ import six import urllib from jinja2 import Environment, StrictUndefined -from jinja2.exceptions import UndefinedError +from jinja2.exceptions import UndefinedError, TemplateSyntaxError # Django from django.core import exceptions as django_exceptions @@ -810,6 +810,12 @@ class CredentialTypeInjectorField(JSONSchemaField): code='invalid', params={'value': value}, ) + except TemplateSyntaxError as e: + raise django_exceptions.ValidationError( + _('Syntax error rendering template for %s inside of %s (%s)') % (key, type_, e), + code='invalid', + params={'value': value}, + ) class AskForField(models.BooleanField):