diff src/plugins/plugin_xep_0100.py @ 941:c6d8fc63b1db

core, plugins: host.getClient now raise an exception instead of returning None when no profile is found, plugins have been adapted consequently and a bit cleaned
author Goffi <goffi@goffi.org>
date Fri, 28 Mar 2014 18:07:02 +0100
parents 1a759096ccbd
children 301b342c697a
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0100.py	Fri Mar 28 18:06:51 2014 +0100
+++ b/src/plugins/plugin_xep_0100.py	Fri Mar 28 18:07:02 2014 +0100
@@ -22,8 +22,7 @@
 from sat.core import exceptions
 from sat.tools import xml_tools
 from logging import debug, info, warning, error
-from twisted.words.protocols.jabber import client as jabber_client, jid
-from twisted.words.protocols.jabber import error as jab_error
+from twisted.words.protocols.jabber import jid
 from twisted.internet import reactor, defer
 
 PLUGIN_INFO = {
@@ -161,7 +160,7 @@
                 else:
                     try:
                         msg = result.value.condition
-                    except AttibuteError:
+                    except AttributeError:
                         msg = str(result)
                 ret.append((success, (msg, items[idx])))
             else:
@@ -206,7 +205,6 @@
         """Find gateways in the target JID, using discovery protocol
         """
         client = self.host.getClient(profile)
-        assert(client)
         debug(_("find gateways (target = %(target)s, profile = %(profile)s)") % {'target': target.full(), 'profile': profile})
         d = client.disco.requestItems(target)
         d.addCallback(self._itemsReceived , target=target, client=client)