From fa67bd3f0e1ad0d30404aacb597f3a0c0387925d Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Thu, 31 Mar 2016 10:24:09 -0400 Subject: [PATCH] unicode safety --- awx/main/fields.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/fields.py b/awx/main/fields.py index d26e64114b..99b45e51ab 100644 --- a/awx/main/fields.py +++ b/awx/main/fields.py @@ -16,6 +16,7 @@ from django.db.models.fields.related import ( ManyRelatedObjectsDescriptor, ReverseManyRelatedObjectsDescriptor, ) +from django.utils.encoding import smart_text # AWX from awx.main.models.rbac import RolePermission, Role, batch_role_ancestor_rebuilding @@ -66,7 +67,7 @@ def resolve_role_field(obj, field): if len(field_components) == 1: if type(obj) is not ImplicitRoleDescriptor and type(obj) is not Role: - raise Exception('%s refers to a %s, not an ImplicitRoleField or Role' % (field, str(type(obj)))) + raise Exception(smart_text('{} refers to a {}, not an ImplicitRoleField or Role').format(field, type(obj))) ret.append(obj) else: if type(obj) is ManyRelatedObjectsDescriptor: