Mercurial > libervia-backend
diff src/plugins/plugin_xep_0096.py @ 1409:3265a2639182
massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 16 Apr 2015 14:57:57 +0200 |
parents | 069ad98b360d |
children | 7b0fcefd52d4 |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0096.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0096.py Thu Apr 16 14:57:57 2015 +0200 @@ -96,7 +96,7 @@ file_size = file_el["size"] file_date = file_el.getAttribute("date", "") file_hash = file_el.getAttribute("hash", "") - log.info(_("File proposed: name=[%(name)s] size=%(size)s") % {'name': filename, 'size': file_size}) + log.info(_(u"File proposed: name=[%(name)s] size=%(size)s") % {'name': filename, 'size': file_size}) for file_child_el in file_el.elements(): if file_child_el.name == "desc": file_desc = unicode(file_child_el) @@ -180,7 +180,7 @@ misc_elts.append(range_elt) self.host.plugins["XEP-0095"].acceptStream(data["id"], data['from'], feature_elt, misc_elts, profile) else: - log.debug(_("Transfer [%s] refused") % sid) + log.debug(_(u"Transfer [%s] refused") % sid) self.host.plugins["XEP-0095"].sendRejectedError(data["id"], data['from'], profile=profile) del(client._xep_0096_waiting_for_approval[sid]) @@ -198,7 +198,7 @@ @param reason: can be TIMEOUT, IO_ERROR, PROTOCOL_ERROR""" client = self.host.getClient(profile) data, timeout, stream_method, failed_methods = client._xep_0096_waiting_for_approval[sid] - log.warning(_('Transfer %(id)s failed with stream method %(s_method)s: %(reason)s') % { + log.warning(_(u'Transfer %(id)s failed with stream method %(s_method)s: %(reason)s') % { 'id': sid, 's_method': stream_method, 'reason': reason}) @@ -213,10 +213,10 @@ if IQ['type'] == "error": stanza_err = jabber.error.exceptionFromStanza(IQ) if stanza_err.code == '403' and stanza_err.condition == 'forbidden': - log.debug(_("File transfer refused by %s") % IQ['from']) + log.debug(_(u"File transfer refused by %s") % IQ['from']) self.host.bridge.newAlert(_("The contact %s refused your file") % IQ['from'], _("File refused"), "INFO", profile) else: - log.warning(_("Error during file transfer with %s") % IQ['from']) + log.warning(_(u"Error during file transfer with %s") % IQ['from']) self.host.bridge.newAlert(_("Something went wrong during the file transfer session intialisation with %s") % IQ['from'], _("File transfer error"), "ERROR", profile) return @@ -289,10 +289,10 @@ return sid def sendSuccessCb(self, sid, file_obj, stream_method, profile): - log.info(_('Transfer %(sid)s successfuly finished [%(profile)s]') + log.info(_(u'Transfer %(sid)s successfuly finished [%(profile)s]') % {"sid": sid, "profile": profile}) file_obj.close() def sendFailureCb(self, sid, file_obj, stream_method, reason, profile): file_obj.close() - log.warning(_('Transfer %(id)s failed with stream method %(s_method)s: %(reason)s [%(profile)s]') % {'id': sid, "s_method": stream_method, 'reason': reason, 'profile': profile}) + log.warning(_(u'Transfer %(id)s failed with stream method %(s_method)s: %(reason)s [%(profile)s]') % {'id': sid, "s_method": stream_method, 'reason': reason, 'profile': profile})