unicode safety

This commit is contained in:
Wayne Witzel III 2016-03-31 10:24:09 -04:00
parent 2ae47a6bab
commit fa67bd3f0e

View File

@ -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: