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

This commit is contained in:
Goffi 2014-03-28 18:07:02 +01:00
commit a6897c76e0

View file

@ -22,8 +22,7 @@ from sat.core.constants import Const as C
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 @@ class XEP_0100(object):
else:
try:
msg = result.value.condition
except AttibuteError:
except AttributeError:
msg = str(result)
ret.append((success, (msg, items[idx])))
else:
@ -206,7 +205,6 @@ class XEP_0100(object):
"""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)