[saml2] properly encode and decode attribute whether they are of str or unicode type

This commit is contained in:
Benjamin Dauvergne 2011-05-06 14:32:09 +00:00
parent 6269a8a886
commit 69517f28ef
1 changed files with 4 additions and 4 deletions

View File

@ -417,12 +417,12 @@ class RootDirectory(common.LassoDirectory):
value = 'true'
elif value is False:
value = 'false'
elif type(value) is unicode:
value = value.encode('utf-8')
elif type(value) is str:
value = sitecharset2utf8(value)
else:
value = str(value)
if type(value) is unicode:
value = value.encode('utf-8')
else:
value = sitecharset2utf8(value)
text_node = lasso.MiscTextNode.newWithString(value)
text_node.textChild = True
attribute_value = lasso.Saml2AttributeValue()