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

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()