diff options
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r-- | sleekxmpp/xmlstream/stanzabase.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py index b95d837f..bccb1fb0 100644 --- a/sleekxmpp/xmlstream/stanzabase.py +++ b/sleekxmpp/xmlstream/stanzabase.py @@ -355,24 +355,24 @@ class ElementBase(object): return self.xml.attrib.get(name, default) def _getSubText(self, name, default=''): - """ - Return the text contents of a sub element. - - In case the element does not exist, or it has no textual content, - a default value can be returned instead. An empty string is returned - if no other default is supplied. - - Arguments: - name -- The name or XPath expression of the element. - default -- Optional default to return if the element does - not exists. An empty string is returned otherwise. - """ - name = self._fix_ns(name) - stanza = self.xml.find(name) - if stanza is None or stanza.text is None: - return default - else: - return stanza.text + """ + Return the text contents of a sub element. + + In case the element does not exist, or it has no textual content, + a default value can be returned instead. An empty string is returned + if no other default is supplied. + + Arguments: + name -- The name or XPath expression of the element. + default -- Optional default to return if the element does + not exists. An empty string is returned otherwise. + """ + name = self._fix_ns(name) + stanza = self.xml.find(name) + if stanza is None or stanza.text is None: + return default + else: + return stanza.text def _setSubText(self, name, text=None, keep=False): """ |