adapters: force template string to be unicode as attributes are unicode values
This commit is contained in:
parent
9643173198
commit
9376d444d4
|
@ -30,7 +30,7 @@ class DefaultAdapter(object):
|
|||
realm = utils.get_setting(idp, 'REALM')
|
||||
username_template = utils.get_setting(idp, 'USERNAME_TEMPLATE')
|
||||
try:
|
||||
username = username_template.format(
|
||||
username = unicode(username_template).format(
|
||||
realm=realm, attributes=saml_attributes, idp=idp)
|
||||
except ValueError:
|
||||
log.error('invalid username template %r'. username_template)
|
||||
|
@ -67,7 +67,7 @@ class DefaultAdapter(object):
|
|||
attribute_mapping = utils.get_setting(idp, 'ATTRIBUTE_MAPPING')
|
||||
for field, tpl in attribute_mapping.iteritems():
|
||||
try:
|
||||
value = tpl.format(realm=realm, attributes=saml_attributes, idp=idp)
|
||||
value = unicode(tpl).format(realm=realm, attributes=saml_attributes, idp=idp)
|
||||
except ValueError:
|
||||
log.warning('invalid attribute mapping template %r', tpl)
|
||||
except (AttributeError, KeyError, IndexError, ValueError), e:
|
||||
|
|
Loading…
Reference in New Issue