summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/tostring/tostring26.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-12-13 14:36:53 -0500
committerLance Stout <lancestout@gmail.com>2010-12-13 14:36:53 -0500
commitc16913c99929a6a5a57611ec8a1757e3e82d4a45 (patch)
treed92b98975b3dc012c734997e6fddc0ac9e2b82d8 /sleekxmpp/xmlstream/tostring/tostring26.py
parent12b61365adbbc910841475ea3cf8204f26ccd9c7 (diff)
parentf4451fe6b72f7cfb9680ead7a608d5ca1bc7e753 (diff)
downloadslixmpp-c16913c99929a6a5a57611ec8a1757e3e82d4a45.tar.gz
slixmpp-c16913c99929a6a5a57611ec8a1757e3e82d4a45.tar.bz2
slixmpp-c16913c99929a6a5a57611ec8a1757e3e82d4a45.tar.xz
slixmpp-c16913c99929a6a5a57611ec8a1757e3e82d4a45.zip
Merge branch 'develop' into roster
Conflicts: sleekxmpp/basexmpp.py
Diffstat (limited to 'sleekxmpp/xmlstream/tostring/tostring26.py')
-rw-r--r--sleekxmpp/xmlstream/tostring/tostring26.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/sleekxmpp/xmlstream/tostring/tostring26.py b/sleekxmpp/xmlstream/tostring/tostring26.py
index 0ee432cc..11501780 100644
--- a/sleekxmpp/xmlstream/tostring/tostring26.py
+++ b/sleekxmpp/xmlstream/tostring/tostring26.py
@@ -55,9 +55,18 @@ def tostring(xml=None, xmlns='', stanza_ns='', stream=None, outbuffer=''):
# Output escaped attribute values.
for attrib, value in xml.attrib.items():
- if '{' not in attrib:
- value = xml_escape(value)
- output.append(u' %s="%s"' % (attrib, value))
+ value = xml_escape(value)
+ if '}' not in attrib:
+ output.append(' %s="%s"' % (attrib, value))
+ else:
+ attrib_ns = attrib.split('}')[0][1:]
+ attrib = attrib.split('}')[1]
+ if stream and attrib_ns in stream.namespace_map:
+ mapped_ns = stream.namespace_map[attrib_ns]
+ if mapped_ns:
+ output.append(' %s:%s="%s"' % (mapped_ns,
+ attrib,
+ value))
if len(xml) or xml.text:
# If there are additional child elements to serialize.