diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2010-12-31 19:19:25 +0100 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2010-12-31 19:19:25 +0100 |
| commit | d90aec17e2201f256783a531c548dcc9857c889d (patch) | |
| tree | 56b6d0580ee1993c73e67c63d4a452a81bbaaf1e /sleekxmpp/stanza/rootstanza.py | |
| parent | af76bcdf7a947702eaa19d39f5b9ecfcd7ec6fd2 (diff) | |
| download | alias-d90aec17e2201f256783a531c548dcc9857c889d.tar.gz | |
Cleanup of repository. Bases of webclient.
* remove sleekxmpp (install guideline in server/README)
* move server code to server directory
* webclient directory with basic strophejs example
Diffstat (limited to 'sleekxmpp/stanza/rootstanza.py')
| -rw-r--r-- | sleekxmpp/stanza/rootstanza.py | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/sleekxmpp/stanza/rootstanza.py b/sleekxmpp/stanza/rootstanza.py deleted file mode 100644 index 6975c72..0000000 --- a/sleekxmpp/stanza/rootstanza.py +++ /dev/null @@ -1,69 +0,0 @@ -""" - SleekXMPP: The Sleek XMPP Library - Copyright (C) 2010 Nathanael C. Fritz - This file is part of SleekXMPP. - - See the file LICENSE for copying permission. -""" - -import logging -import traceback -import sys - -from sleekxmpp.exceptions import XMPPError -from sleekxmpp.stanza import Error -from sleekxmpp.xmlstream import ET, StanzaBase, register_stanza_plugin - - -log = logging.getLogger(__name__) - - -class RootStanza(StanzaBase): - - """ - A top-level XMPP stanza in an XMLStream. - - The RootStanza class provides a more XMPP specific exception - handler than provided by the generic StanzaBase class. - - Methods: - exception -- Overrides StanzaBase.exception - """ - - def exception(self, e): - """ - Create and send an error reply. - - Typically called when an event handler raises an exception. - The error's type and text content are based on the exception - object's type and content. - - Overrides StanzaBase.exception. - - Arguments: - e -- Exception object - """ - self.reply() - if isinstance(e, XMPPError): - # We raised this deliberately - self['error']['condition'] = e.condition - self['error']['text'] = e.text - if e.extension is not None: - # Extended error tag - extxml = ET.Element("{%s}%s" % (e.extension_ns, e.extension), - e.extension_args) - self['error'].append(extxml) - self['error']['type'] = e.etype - else: - # We probably didn't raise this on purpose, so send a traceback - self['error']['condition'] = 'undefined-condition' - if sys.version_info < (3, 0): - self['error']['text'] = "SleekXMPP got into trouble." - else: - self['error']['text'] = traceback.format_tb(e.__traceback__) - log.exception('Error handling {%s}%s stanza' % - (self.namespace, self.name)) - self.send() - - -register_stanza_plugin(RootStanza, Error) |
