Fixed the identifier for base64 value type

This commit is contained in:
Roland Hedberg
2010-03-15 10:41:26 +01:00
parent aaeec8affa
commit 6f2160a6da
4 changed files with 4 additions and 4 deletions

View File

@@ -855,7 +855,7 @@ def _decode_attribute_value(typ, text):
return str(float(text)) return str(float(text))
if typ == XSD + "boolean": if typ == XSD + "boolean":
return "%s" % (text == "true") return "%s" % (text == "true")
if typ == NS_SOAP_ENC + "base64": if typ == XSD + "base64Binary":
import base64 import base64
return base64.decodestring(text) return base64.decodestring(text)
raise ValueError("type %s not supported" % type) raise ValueError("type %s not supported" % type)

View File

@@ -168,7 +168,7 @@ def make_instance(klass, spec, base64encode=False):
if base64encode: if base64encode:
import base64 import base64
val = base64.encodestring(val) val = base64.encodestring(val)
setattr(klass_inst, "type", saml.NS_SOAP_ENC + "base64") setattr(klass_inst, "type", "xs:base64Binary")
else: else:
if isinstance(val, basestring): if isinstance(val, basestring):
print "basestring" print "basestring"

View File

@@ -400,7 +400,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
Name="FirstName"> Name="FirstName">
<AttributeValue <AttributeValue
xsi:type="http://schemas.xmlsoap.org/soap/encoding/base64">VU5JTkVUVA==</AttributeValue> xsi:type="xs:base64Binary">VU5JTkVUVA==</AttributeValue>
</Attribute>""" </Attribute>"""
X500_AV = """<?xml version="1.0" encoding="utf-8"?> X500_AV = """<?xml version="1.0" encoding="utf-8"?>

View File

@@ -152,7 +152,7 @@ def test_attribute_base64():
assert inst.name == "name" assert inst.name == "name"
assert len(inst.attribute_value) == 1 assert len(inst.attribute_value) == 1
av = inst.attribute_value[0] av = inst.attribute_value[0]
assert av.type == "http://schemas.xmlsoap.org/soap/encoding/base64" assert av.type == "xs:base64Binary"
assert av.text.strip() == "U2VsbWEgTGFnZXJsw7Zm" assert av.text.strip() == "U2VsbWEgTGFnZXJsw7Zm"
def test_attribute_statement(): def test_attribute_statement():