summaryrefslogtreecommitdiff
path: root/sleekxmpp/exceptions.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-02-11 15:20:26 -0500
committerLance Stout <lancestout@gmail.com>2011-02-11 15:20:26 -0500
commit0d326383799a7d7bb69fec9dcd1eaf9e1a64eab8 (patch)
tree20bf5d0037cdd33bf45460c7001dd593643293b0 /sleekxmpp/exceptions.py
parentc4b1212c44e0758c6361ca46c6c3a90e27ac876f (diff)
downloadslixmpp-0d326383799a7d7bb69fec9dcd1eaf9e1a64eab8.tar.gz
slixmpp-0d326383799a7d7bb69fec9dcd1eaf9e1a64eab8.tar.bz2
slixmpp-0d326383799a7d7bb69fec9dcd1eaf9e1a64eab8.tar.xz
slixmpp-0d326383799a7d7bb69fec9dcd1eaf9e1a64eab8.zip
XMPPError exceptions can keep a stanza's contents.
This allows exceptions to include the original content of a stanza in the error response by including the parameter clear=False when raising the exception.
Diffstat (limited to 'sleekxmpp/exceptions.py')
-rw-r--r--sleekxmpp/exceptions.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/sleekxmpp/exceptions.py b/sleekxmpp/exceptions.py
index d3988b4a..4727f0c6 100644
--- a/sleekxmpp/exceptions.py
+++ b/sleekxmpp/exceptions.py
@@ -21,7 +21,8 @@ class XMPPError(Exception):
"""
def __init__(self, condition='undefined-condition', text=None, etype=None,
- extension=None, extension_ns=None, extension_args=None):
+ extension=None, extension_ns=None, extension_args=None,
+ clear=True):
"""
Create a new XMPPError exception.
@@ -37,6 +38,9 @@ class XMPPError(Exception):
extension_args -- Content and attributes for the extension
element. Same as the additional arguments to
the ET.Element constructor.
+ clear -- Indicates if the stanza's contents should be
+ removed before replying with an error.
+ Defaults to True.
"""
if extension_args is None:
extension_args = {}
@@ -44,6 +48,7 @@ class XMPPError(Exception):
self.condition = condition
self.text = text
self.etype = etype
+ self.clear = clear
self.extension = extension
self.extension_ns = extension_ns
self.extension_args = extension_args