summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-10-07 19:42:28 -0400
committerLance Stout <lancestout@gmail.com>2010-10-07 19:42:28 -0400
commite02ffe854745c6c39127967f5d1dcaff915d7190 (patch)
treee33e2c0557412fd59532788ce0d1a0a8370fc60b /sleekxmpp
parent42bfca1c8785c6dd15260c22acda6375f3dbf908 (diff)
downloadslixmpp-e02ffe854745c6c39127967f5d1dcaff915d7190.tar.gz
slixmpp-e02ffe854745c6c39127967f5d1dcaff915d7190.tar.bz2
slixmpp-e02ffe854745c6c39127967f5d1dcaff915d7190.tar.xz
slixmpp-e02ffe854745c6c39127967f5d1dcaff915d7190.zip
Corrected test errors.
There was a bug in the XML compare method.
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/stanza/presence.py12
-rw-r--r--sleekxmpp/xmlstream/stanzabase.py4
2 files changed, 14 insertions, 2 deletions
diff --git a/sleekxmpp/stanza/presence.py b/sleekxmpp/stanza/presence.py
index 651bf34d..7eb0c5b1 100644
--- a/sleekxmpp/stanza/presence.py
+++ b/sleekxmpp/stanza/presence.py
@@ -78,7 +78,9 @@ class Presence(RootStanza):
Arguments:
show -- Must be one of: away, chat, dnd, or xa.
"""
- if show in self.showtypes:
+ if show is None:
+ self._delSub('show')
+ elif show in self.showtypes:
self._setSubText('show', text=show)
return self
@@ -99,6 +101,14 @@ class Presence(RootStanza):
self['show'] = value
return self
+ def delType(self):
+ """
+ Remove both the type attribute and the <show> element.
+ """
+ self._delAttr('type')
+ self._delSub('show')
+
+
def setPriority(self, value):
"""
Set the entity's priority value. Some server use priority to
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py
index f4a7e506..6851333f 100644
--- a/sleekxmpp/xmlstream/stanzabase.py
+++ b/sleekxmpp/xmlstream/stanzabase.py
@@ -423,7 +423,9 @@ class ElementBase(object):
self._delAttr(attrib)
elif attrib in self.plugin_attrib_map:
if attrib in self.plugins:
+ xml = self.plugins[attrib].xml
del self.plugins[attrib]
+ self.xml.remove(xml)
return self
def _setAttr(self, name, value):
@@ -511,7 +513,7 @@ class ElementBase(object):
element = self.xml.find(name)
if not text and not keep:
- return self.__delitem__(name)
+ return self._delSub(name)
if element is None:
# We need to add the element. If the provided name was