summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/stanzabase.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-01-27 18:05:05 -0500
committerLance Stout <lancestout@gmail.com>2011-01-27 18:05:05 -0500
commitbd9bf3f1c7c17606f455ce0cf9c4d0b6b237a7fe (patch)
tree944aeaa34849e7fb6d822e9d3ff98b6db3a65546 /sleekxmpp/xmlstream/stanzabase.py
parentcd800d636aa683dc562047bc517be7d1a9bb25c2 (diff)
downloadslixmpp-bd9bf3f1c7c17606f455ce0cf9c4d0b6b237a7fe.tar.gz
slixmpp-bd9bf3f1c7c17606f455ce0cf9c4d0b6b237a7fe.tar.bz2
slixmpp-bd9bf3f1c7c17606f455ce0cf9c4d0b6b237a7fe.tar.xz
slixmpp-bd9bf3f1c7c17606f455ce0cf9c4d0b6b237a7fe.zip
Update tostring methods.
Will now always show top-level namespace, unless it is the same as the stream's default namespace. Also added the XMPP stream namespace to the namespace map as 'stream'.
Diffstat (limited to 'sleekxmpp/xmlstream/stanzabase.py')
-rw-r--r--sleekxmpp/xmlstream/stanzabase.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py
index 3937a7a9..83d86999 100644
--- a/sleekxmpp/xmlstream/stanzabase.py
+++ b/sleekxmpp/xmlstream/stanzabase.py
@@ -1007,7 +1007,9 @@ class ElementBase(object):
"""
Return a string serialization of the underlying XML object.
"""
- return tostring(self.xml, xmlns='', stanza_ns=self.namespace)
+ return tostring(self.xml, xmlns='',
+ stanza_ns=self.namespace,
+ top_level=True)
def __repr__(self):
"""
@@ -1217,4 +1219,5 @@ class StanzaBase(ElementBase):
"""Serialize the stanza's XML to a string."""
return tostring(self.xml, xmlns='',
stanza_ns=self.namespace,
- stream=self.stream)
+ stream=self.stream,
+ top_level = True)