plugins XEP-0047, XEP-0065, XEP-0096: fixed use of failure.condition insteand of failure.value + removed gettext use for local logs

This commit is contained in:
Goffi 2015-11-13 16:46:31 +01:00
commit ab910bebfe
3 changed files with 10 additions and 10 deletions

View file

@ -82,7 +82,7 @@ class XEP_0047(object):
@param sid(unicode): session id of client.xep_0047_current_stream
@param client: %(doc_client)s
"""
log.info(_("In-Band Bytestream: TimeOut reached for id {sid} [{profile}]")
log.info(u"In-Band Bytestream: TimeOut reached for id {sid} [{profile}]"
.format(sid=sid, profile=client.profile))
self._killSession(sid, client, "TIMEOUT")
@ -97,7 +97,7 @@ class XEP_0047(object):
try:
session = client.xep_0047_current_stream[sid]
except KeyError:
log.warning(_("kill id called on a non existant id"))
log.warning(u"kill id called on a non existant id")
return
try:
@ -331,9 +331,9 @@ class XEP_0047(object):
def _IQDataStreamEb(self, failure, session_data, client):
if failure.check(error.StanzaError):
log.warning(u"IBB transfer failed: {}".format(failure.condition))
log.warning(u"IBB transfer failed: {}".format(failure.value))
else:
log.error(u"IBB transfer failed: {}".format(failure.condition))
log.error(u"IBB transfer failed: {}".format(failure.value))
self.terminateStream(session_data, client, "IQ_ERROR")
def terminateStream(self, session_data, client, failure_reason=None):

View file

@ -1062,7 +1062,7 @@ class XEP_0065(object):
log.warning(u"Proxy activation error: {}".format(failure.value))
def _IQNegotiationEb(self, stanza_err, session_data, client):
log.warning(u"Socks5 transfer failed: {}".format(stanza_err.condition))
log.warning(u"Socks5 transfer failed: {}".format(stanza_err.value))
# FIXME: must clean session
def createSession(self, *args, **kwargs):

View file

@ -158,9 +158,9 @@ class XEP_0096(object):
elif stream_method == self.host.plugins["XEP-0047"].NAMESPACE:
plugin = self.host.plugins["XEP-0047"]
else:
log.error(_("Unknown stream method, this should not happen at this stage, cancelling transfer"))
log.error(u"Unknown stream method, this should not happen at this stage, cancelling transfer")
else:
log.warning(_("Can't find a valid stream method"))
log.warning(u"Can't find a valid stream method")
self._si.sendError(iq_elt, 'not-acceptable', profile)
return
@ -245,7 +245,7 @@ class XEP_0096(object):
@param data: session data
@param profile: %(doc_profile)s
"""
log.warning(u'Transfer {si_id} failed: {reason}'.format(reason=unicode(failure.condition), **data))
log.warning(u'Transfer {si_id} failed: {reason}'.format(reason=unicode(failure.value), **data))
data['file_obj'].close()
def _sendFile(self, peer_jid_s, filepath, name, desc, profile=C.PROF_KEY_NONE):
@ -333,7 +333,7 @@ class XEP_0096(object):
self.host.bridge.newAlert(_("The contact {} has refused your file").format(from_s), _("File refused"), "INFO", client.profile)
else:
log.warning(_(u"Error during file transfer"))
self.host.bridge.newAlert(_(u"Something went wrong during the file transfer session intialisation: {reason}").format(reason=unicode(stanza_err.condition)), _("File transfer error"), "ERROR", client.profile)
self.host.bridge.newAlert(_(u"Something went wrong during the file transfer session intialisation: {reason}").format(reason=unicode(stanza_err.value)), _("File transfer error"), "ERROR", client.profile)
elif failure.check(exceptions.DataError):
log.warning(u'Invalid stanza received')
else:
@ -349,6 +349,6 @@ class XEP_0096(object):
log.warning(_(u'transfer {sid} failed [{profile}]: {reason}').format(
sid=sid,
profile=profile,
reason=unicode(failure.condition),
reason=unicode(failure.value),
))
file_obj.close()