summaryrefslogtreecommitdiff
path: root/sleekxmpp/stanza/error.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-06-19 21:50:33 -0700
committerLance Stout <lancestout@gmail.com>2012-06-19 21:50:33 -0700
commit5820d49cd401a1362a8a675c4b91935adb1240fe (patch)
treef40f78839ae3004bfb0b8da1ae93d61759d8ad66 /sleekxmpp/stanza/error.py
parent1ab66e576786ecb0cfb9b6b163811735564b951b (diff)
parent36c11ad9de7c1b5a199aa5a4302e33085513c126 (diff)
downloadslixmpp-5820d49cd401a1362a8a675c4b91935adb1240fe.tar.gz
slixmpp-5820d49cd401a1362a8a675c4b91935adb1240fe.tar.bz2
slixmpp-5820d49cd401a1362a8a675c4b91935adb1240fe.tar.xz
slixmpp-5820d49cd401a1362a8a675c4b91935adb1240fe.zip
Merge branch 'master' into develop
Conflicts: sleekxmpp/basexmpp.py
Diffstat (limited to 'sleekxmpp/stanza/error.py')
-rw-r--r--sleekxmpp/stanza/error.py34
1 files changed, 31 insertions, 3 deletions
diff --git a/sleekxmpp/stanza/error.py b/sleekxmpp/stanza/error.py
index 825287ad..60bc65bc 100644
--- a/sleekxmpp/stanza/error.py
+++ b/sleekxmpp/stanza/error.py
@@ -51,7 +51,8 @@ class Error(ElementBase):
namespace = 'jabber:client'
name = 'error'
plugin_attrib = 'error'
- interfaces = set(('code', 'condition', 'text', 'type'))
+ interfaces = set(('code', 'condition', 'text', 'type',
+ 'gone', 'redirect'))
sub_interfaces = set(('text',))
plugin_attrib_map = {}
plugin_tag_map = {}
@@ -88,7 +89,7 @@ class Error(ElementBase):
def get_condition(self):
"""Return the condition element's name."""
- for child in self.xml.getchildren():
+ for child in self.xml:
if "{%s}" % self.condition_ns in child.tag:
cond = child.tag.split('}', 1)[-1]
if cond in self.conditions:
@@ -109,7 +110,7 @@ class Error(ElementBase):
def del_condition(self):
"""Remove the condition element."""
- for child in self.xml.getchildren():
+ for child in self.xml:
if "{%s}" % self.condition_ns in child.tag:
tag = child.tag.split('}', 1)[-1]
if tag in self.conditions:
@@ -135,6 +136,33 @@ class Error(ElementBase):
self._del_sub('{%s}text' % self.condition_ns)
return self
+ def get_gone(self):
+ return self._get_sub_text('{%s}gone' % self.condition_ns, '')
+
+ def get_redirect(self):
+ return self._get_sub_text('{%s}redirect' % self.condition_ns, '')
+
+ def set_gone(self, value):
+ 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):
+ 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)
+
+ def del_redirect(self):
+ self._del_sub('{%s}redirect' % self.condition_ns)
+
# To comply with PEP8, method names now use underscores.
# Deprecated method names are re-mapped for backwards compatibility.