summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-03-18 17:36:35 -0400
committerLance Stout <lancestout@gmail.com>2011-03-18 17:36:35 -0400
commitb048f8d733dd7121d820fa196b5de5c9a77adae2 (patch)
treecbd1c1e0bccbd1a48cd21f1a90c82781f61294c6
parentf65f88325b8d76a9b44a7cb4006a0a62d061e7ef (diff)
parentdbf6780345bb202d4a0a49034fbfc4535e844170 (diff)
downloadslixmpp-b048f8d733dd7121d820fa196b5de5c9a77adae2.tar.gz
slixmpp-b048f8d733dd7121d820fa196b5de5c9a77adae2.tar.bz2
slixmpp-b048f8d733dd7121d820fa196b5de5c9a77adae2.tar.xz
slixmpp-b048f8d733dd7121d820fa196b5de5c9a77adae2.zip
Merge branch 'develop' into roster
-rw-r--r--sleekxmpp/plugins/xep_0092/version.py2
-rw-r--r--sleekxmpp/xmlstream/stanzabase.py22
2 files changed, 18 insertions, 6 deletions
diff --git a/sleekxmpp/plugins/xep_0092/version.py b/sleekxmpp/plugins/xep_0092/version.py
index 46bb27f7..1ca6c15e 100644
--- a/sleekxmpp/plugins/xep_0092/version.py
+++ b/sleekxmpp/plugins/xep_0092/version.py
@@ -42,7 +42,7 @@ class xep_0092(base_plugin):
self.xmpp.register_handler(
Callback('Software Version',
- StanzaPath('iq@=get/software_version'),
+ StanzaPath('iq@type=get/software_version'),
self._handle_version))
register_stanza_plugin(Iq, Version)
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py
index 753977c1..e9c7fc7a 100644
--- a/sleekxmpp/xmlstream/stanzabase.py
+++ b/sleekxmpp/xmlstream/stanzabase.py
@@ -991,11 +991,16 @@ class ElementBase(object):
"""
return self.__class__(xml=copy.deepcopy(self.xml), parent=self.parent)
- def __str__(self):
+ def __str__(self, top_level_ns=True):
"""
Return a string serialization of the underlying XML object.
+
+ Arguments:
+ top_level_ns -- Display the top-most namespace.
+ Defaults to True.
"""
- return tostring(self.xml, xmlns='', stanza_ns=self.namespace)
+ stanza_ns = '' if top_level_ns else self.namespace
+ return tostring(self.xml, xmlns='', stanza_ns=stanza_ns)
def __repr__(self):
"""
@@ -1196,10 +1201,17 @@ class StanzaBase(ElementBase):
return self.__class__(xml=copy.deepcopy(self.xml),
stream=self.stream)
- def __str__(self):
- """Serialize the stanza's XML to a string."""
+ def __str__(self, top_level_ns=False):
+ """
+ Serialize the stanza's XML to a string.
+
+ Arguments:
+ top_level_ns -- Display the top-most namespace.
+ Defaults to False.
+ """
+ stanza_ns = '' if top_level_ns else self.namespace
return tostring(self.xml, xmlns='',
- stanza_ns=self.namespace,
+ stanza_ns=stanza_ns,
stream=self.stream)