summaryrefslogtreecommitdiff
path: root/slixmpp/xmlstream/tostring.py
diff options
context:
space:
mode:
Diffstat (limited to 'slixmpp/xmlstream/tostring.py')
-rw-r--r--slixmpp/xmlstream/tostring.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/slixmpp/xmlstream/tostring.py b/slixmpp/xmlstream/tostring.py
index 6726bf1e..de6fe47d 100644
--- a/slixmpp/xmlstream/tostring.py
+++ b/slixmpp/xmlstream/tostring.py
@@ -45,11 +45,12 @@ def tostring(xml=None, xmlns='', stream=None, outbuffer='',
output = [outbuffer]
# Extract the element's tag name.
- tag_name = xml.tag.split('}', 1)[-1]
+ tag_split = xml.tag.split('}', 1)
+ tag_name = tag_split[-1]
# Extract the element's namespace if it is defined.
if '}' in xml.tag:
- tag_xmlns = xml.tag.split('}', 1)[0][1:]
+ tag_xmlns = tag_split[0][1:]
else:
tag_xmlns = ''
@@ -82,8 +83,9 @@ def tostring(xml=None, xmlns='', stream=None, outbuffer='',
if '}' not in attrib:
output.append(' %s="%s"' % (attrib, value))
else:
- attrib_ns = attrib.split('}')[0][1:]
- attrib = attrib.split('}')[1]
+ attrib_split = attrib.split('}')
+ attrib_ns = attrib_split[0][1:]
+ attrib = attrib_split[1]
if attrib_ns == XML_NS:
output.append(' xml:%s="%s"' % (attrib, value))
elif stream and attrib_ns in stream.namespace_map: