summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-07-29 11:04:21 -0400
committerLance Stout <lancestout@gmail.com>2010-07-29 11:04:21 -0400
commitd148f633f3771c43c94229bfcd2104b65396f5e1 (patch)
treeffce10f530fbff25a8d3eab0241a3a21bd3d7e83 /sleekxmpp/xmlstream
parente8e934fa95ea776d067d875fa67e89cc9e273e90 (diff)
downloadslixmpp-d148f633f3771c43c94229bfcd2104b65396f5e1.tar.gz
slixmpp-d148f633f3771c43c94229bfcd2104b65396f5e1.tar.bz2
slixmpp-d148f633f3771c43c94229bfcd2104b65396f5e1.tar.xz
slixmpp-d148f633f3771c43c94229bfcd2104b65396f5e1.zip
Modified ElementBase _getSubText, _setSubText, and _delSubText to
use the namespace in a tag name if one is given and to use self.namespace otherwise.
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r--sleekxmpp/xmlstream/stanzabase.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py
index b8c80ffa..5b41a406 100644
--- a/sleekxmpp/xmlstream/stanzabase.py
+++ b/sleekxmpp/xmlstream/stanzabase.py
@@ -239,26 +239,31 @@ class ElementBase(tostring.ToString):
return self.xml.attrib.get(name, '')
def _getSubText(self, name):
- stanza = self.xml.find("{%s}%s" % (self.namespace, name))
+ if '}' not in name:
+ name = "{%s}%s" % (self.namespace, name)
+ stanza = self.xml.find(name)
if stanza is None or stanza.text is None:
return ''
else:
return stanza.text
def _setSubText(self, name, attrib={}, text=None):
+ if '}' not in name:
+ name = "{%s}%s" % (self.namespace, name)
if text is None or text == '':
return self.__delitem__(name)
- stanza = self.xml.find("{%s}%s" % (self.namespace, name))
+ stanza = self.xml.find(name)
if stanza is None:
- #self.xml.append(ET.Element("{%s}%s" % (self.namespace, name), attrib))
- stanza = ET.Element("{%s}%s" % (self.namespace, name))
+ stanza = ET.Element(name)
self.xml.append(stanza)
stanza.text = text
return stanza
def _delSub(self, name):
+ if '}' not in name:
+ name = "{%s}%s" % (self.namespace, name)
for child in self.xml.getchildren():
- if child.tag == "{%s}%s" % (self.namespace, name):
+ if child.tag == name:
self.xml.remove(child)
def getStanzaValues(self):