From 019a4b20ae5284ec07d4ecc5e5136be5012e88bd Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 19 Jun 2012 16:21:34 -0700 Subject: Fix assigning values to error stanzas. The new data interfaces were deleting the actual error conditions if they were set afterward with falsy data. --- sleekxmpp/stanza/error.py | 8 ++++++-- sleekxmpp/stanza/stream_error.py | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'sleekxmpp/stanza') diff --git a/sleekxmpp/stanza/error.py b/sleekxmpp/stanza/error.py index 8d9266bd..60bc65bc 100644 --- a/sleekxmpp/stanza/error.py +++ b/sleekxmpp/stanza/error.py @@ -143,15 +143,19 @@ class Error(ElementBase): return self._get_sub_text('{%s}redirect' % self.condition_ns, '') def set_gone(self, value): - del self['condition'] if value: + del self['condition'] return self._set_sub_text('{%s}gone' % self.condition_ns, value) + elif self['condition'] == 'gone': + del self['condition'] def set_redirect(self, value): - del self['condition'] if value: + del self['condition'] ns = self.condition_ns return self._set_sub_text('{%s}redirect' % ns, value) + elif self['condition'] == 'redirect': + del self['condition'] def del_gone(self): self._del_sub('{%s}gone' % self.condition_ns) diff --git a/sleekxmpp/stanza/stream_error.py b/sleekxmpp/stanza/stream_error.py index 8c541da4..ed0078c9 100644 --- a/sleekxmpp/stanza/stream_error.py +++ b/sleekxmpp/stanza/stream_error.py @@ -72,10 +72,12 @@ class StreamError(Error, StanzaBase): return self._get_sub_text('{%s}see-other-host' % ns, '') def set_see_other_host(self, value): - del self['condition'] if value: + del self['condition'] ns = self.condition_ns return self._set_sub_text('{%s}see-other-host' % ns, value) + elif self['condition'] == 'see-other-host': + del self['condition'] def del_see_other_host(self): self._del_sub('{%s}see-other-host' % self.condition_ns) -- cgit v1.2.3