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

@ -21,11 +21,7 @@ from sat.core.i18n import _
from sat.core.constants import Const as C
from logging import debug, info, error
from twisted.words.xish import domish
from twisted.internet import protocol
from twisted.words.protocols.jabber import client, jid
from twisted.words.protocols.jabber import error as jab_error
import os.path
from twisted.internet import reactor
from twisted.words.protocols.jabber import client
import uuid
from zope.interface import implements
@ -125,8 +121,7 @@ class XEP_0095(object):
@param data: error specific data (dictionary)
@param profile: %(doc_profile)s
"""
_client = self.host.getClient(profile)
assert(_client)
client_ = self.host.getClient(profile)
result = domish.Element((None, 'iq'))
result['type'] = 'result'
result['id'] = iq_id
@ -149,7 +144,7 @@ class XEP_0095(object):
if 'custom' in data and data['custom'] == 'failed':
condition_el.addContent('Stream failed')
_client.xmlstream.send(result)
client_.xmlstream.send(result)
def acceptStream(self, iq_id, to_jid, feature_elt, misc_elts=[], profile=C.PROF_KEY_NONE):
"""Send the accept stream initiation answer