diff src/plugins/plugin_xep_0096.py @ 1583:d46aae87c03a

plugins XEP-0047, XEP-0065, XEP-0096: fixed use of failure.condition insteand of failure.value + removed gettext use for local logs
author Goffi <goffi@goffi.org>
date Fri, 13 Nov 2015 16:46:31 +0100
parents d04d7402b8e9
children 846a39900fa6
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0096.py	Fri Nov 13 16:45:56 2015 +0100
+++ b/src/plugins/plugin_xep_0096.py	Fri Nov 13 16:46:31 2015 +0100
@@ -158,9 +158,9 @@
             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 @@
         @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 @@
                 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 @@
         log.warning(_(u'transfer {sid} failed [{profile}]: {reason}').format(
             sid=sid,
             profile=profile,
-            reason=unicode(failure.condition),
+            reason=unicode(failure.value),
             ))
         file_obj.close()