Skip to content

Commit b3cc7c4

Browse files
committed
It's cleaner to conditionally add this attribute
As per @jgehrcke's comment
1 parent 4d31c9c commit b3cc7c4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/saml2/saml.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,16 @@ def set_type(self, typ):
166166

167167
try:
168168
self.extension_attributes[XSI_TYPE] = typ
169-
self.extension_attributes['xmlns:xs'] = XS_NAMESPACE
170169
except AttributeError:
171-
self._extatt['xmlns:xs'] = XS_NAMESPACE
172170
self._extatt[XSI_TYPE] = typ
173171

172+
if typ.startswith('xs:'):
173+
try:
174+
self.extension_attributes['xmlns:xs'] = XS_NAMESPACE
175+
except AttributeError:
176+
self._extatt['xmlns:xs'] = XS_NAMESPACE
177+
178+
174179
def get_type(self):
175180
try:
176181
return self.extension_attributes[XSI_TYPE]

0 commit comments

Comments
 (0)