Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
systemsmanagement:Ardana:8:CentOS
python-pysaml2
0005-Fix-the-parser-to-not-break-on-ePTID-Attri...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0005-Fix-the-parser-to-not-break-on-ePTID-AttributeValues.patch of Package python-pysaml2
From cf7b31a2dfafd4bed76db9407790658652f035fb Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis <ivan.kanak@gmail.com> Date: Fri, 15 Jan 2021 15:09:58 +0200 Subject: [PATCH 5/9] Fix the parser to not break on ePTID AttributeValues Conflicts: src/saml2/saml.py Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com> (cherry picked from commit cd6030d79e23d2421ff8b8bcbebb9632bc4caedc) (cherry picked from commit 955cf7eb55ae9ce43d21282b976f84e04220f324) --- src/saml2/saml.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/saml2/saml.py b/src/saml2/saml.py index a7647829..264dbdd8 100644 --- a/src/saml2/saml.py +++ b/src/saml2/saml.py @@ -148,7 +148,7 @@ class AttributeValueBase(SamlBase): SamlBase.__setattr__(self, key, value) def verify(self): - if not self.text: + if not self.text and not self.extension_elements: assert self.extension_attributes assert self.extension_attributes[XSI_NIL] == "true" return True @@ -255,11 +255,26 @@ class AttributeValueBase(SamlBase): self._convert_element_tree_to_member(child) for attribute, value in iter(tree.attrib.items()): self._convert_element_attribute_to_member(attribute, value) - if tree.text: + + # if we have added children to this node + # we consider whitespace insignificant + # and remove/trim/strip whitespace + # and expect to not have actual text content + text = ( + tree.text.strip() + if tree.text and self.extension_elements + else tree.text + ) + if text: #print("set_text:", tree.text) # clear type #self.clear_type() - self.set_text(tree.text) + self.set_text(text) + + # if we have added a text node + # or other children to this node + # remove the nil marker + if text or self.extension_elements: if XSI_NIL in self.extension_attributes: del self.extension_attributes[XSI_NIL] try: -- 2.30.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor