From 0d326383799a7d7bb69fec9dcd1eaf9e1a64eab8 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Fri, 11 Feb 2011 15:20:26 -0500 Subject: 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. --- sleekxmpp/exceptions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sleekxmpp/exceptions.py') 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 -- cgit v1.2.3