MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / postprocess

Method postprocess

suds/umx/core.py:72–111  ·  view source on GitHub ↗

Perform final processing of the resulting data structure as follows: - Mixed values (children and text) will have a result of the I{content.node}. - Semi-simple values (attributes, no-children and text) will have a result of a property object.

(self, content)

Source from the content-addressed store, hash-verified

70 return self.postprocess(content)
71
72 def postprocess(self, content):
73 """
74 Perform final processing of the resulting data structure as follows:
75 - Mixed values (children and text) will have a result of the
76 I{content.node}.
77 - Semi-simple values (attributes, no-children and text) will have a
78 result of a property object.
79 - Simple values (no-attributes, no-children with text nodes) will
80 have a string result equal to the value of the
81 content.node.getText().
82 @param content: The current content being unmarshalled.
83 @type content: L{Content}
84 @return: The post-processed result.
85 @rtype: I{any}
86 """
87 node = content.node
88 if len(node.children) and node.hasText():
89 return node
90 attributes = AttrList(node.attributes)
91 if (
92 attributes.rlen() and
93 not len(node.children) and
94 node.hasText()
95 ):
96 p = Factory.property(node.name, node.getText())
97 return merge(content.data, p)
98 if len(content.data):
99 return content.data
100 lang = attributes.lang()
101 if content.node.isnil():
102 return None
103 if not len(node.children) and content.text is None:
104 if self.nillable(content):
105 return None
106 else:
107 return Text('', lang=lang)
108 if isinstance(content.text, basestring):
109 return Text(content.text, lang=lang)
110 else:
111 return content.text
112
113 def append_attributes(self, content):
114 """

Callers 1

appendMethod · 0.95

Calls 10

rlenMethod · 0.95
langMethod · 0.95
nillableMethod · 0.95
AttrListClass · 0.90
mergeFunction · 0.90
TextClass · 0.90
propertyMethod · 0.80
getTextMethod · 0.80
isnilMethod · 0.80
hasTextMethod · 0.45

Tested by

no test coverage detected