Mercurial > libervia-backend
diff src/core/sat_main.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 | 176de79c8c39 |
line wrap: on
line diff
--- a/src/core/sat_main.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/core/sat_main.py Thu Apr 16 14:57:57 2015 +0200 @@ -162,7 +162,7 @@ try: __import__(plugin_path) except ImportError as e: - log.error(_("Can't import plugin [%(path)s]: %(error)s") % {'path': plugin_path, 'error':e}) + log.error(_(u"Can't import plugin [%(path)s]: %(error)s") % {'path': plugin_path, 'error':e}) continue mod = sys.modules[plugin_path] plugin_info = mod.PLUGIN_INFO @@ -180,27 +180,27 @@ """ if import_name in self.plugins: - log.debug('Plugin [%s] already imported, passing' % import_name) + log.debug(u'Plugin [%s] already imported, passing' % import_name) return if not import_name: import_name, (plugin_path, mod, plugin_info) = plugins_to_import.popitem() else: if not import_name in plugins_to_import: if optional: - log.warning(_("Recommended plugin not found: %s") % import_name) + log.warning(_(u"Recommended plugin not found: %s") % import_name) return - log.error(_("Dependency not found: %s") % import_name) + log.error(_(u"Dependency not found: %s") % import_name) raise ImportError(_('Dependency plugin not found: [%s]') % import_name) plugin_path, mod, plugin_info = plugins_to_import.pop(import_name) dependencies = plugin_info.setdefault("dependencies", []) recommendations = plugin_info.setdefault("recommendations", []) for to_import in dependencies + recommendations: if to_import not in self.plugins: - log.debug('Recursively import dependency of [%s]: [%s]' % (import_name, to_import)) + log.debug(u'Recursively import dependency of [%s]: [%s]' % (import_name, to_import)) try: self._import_plugins_from_dict(plugins_to_import, to_import, to_import not in dependencies) except ImportError as e: - log.error(_("Can't import plugin %(name)s: %(error)s") % {'name':plugin_info['name'], 'error':e}) + log.error(_(u"Can't import plugin %(name)s: %(error)s") % {'name':plugin_info['name'], 'error':e}) return log.info(_("importing plugin: %s") % plugin_info['name']) self.plugins[import_name] = getattr(mod, plugin_info['main'])(self) @@ -305,10 +305,10 @@ def logPluginResults(results): all_succeed = all([success for success, result in results]) if not all_succeed: - log.error(_("Plugins initialisation error")) + log.error(_(u"Plugins initialisation error")) for idx, (success, result) in enumerate(results): if not success: - log.error("error (plugin %(name)s): %(failure)s" % + log.error(u"error (plugin %(name)s): %(failure)s" % {'name': plugin_conn_cb[idx][0], 'failure': result}) yield list_d.addCallback(logPluginResults) # FIXME: we should have a timeout here, and a way to know if a plugin freeze @@ -330,7 +330,7 @@ def check_result(result): if not result: - log.warning(_('Authentication failure of profile %s') % profile) + log.warning(_(u'Authentication failure of profile %s') % profile) raise exceptions.PasswordError(D_("The provided profile password doesn't match.")) if not session_data: # avoid to create two profile sessions when password if specified return self.memory.newAuthSession(password, profile) @@ -616,7 +616,7 @@ profile = self.memory.getProfileName(profile_key) assert profile to_jid = jid.JID(raw_jid) - log.debug(_('subsciption request [%(subs_type)s] for %(jid)s') % {'subs_type': subs_type, 'jid': to_jid.full()}) + log.debug(_(u'subsciption request [%(subs_type)s] for %(jid)s') % {'subs_type': subs_type, 'jid': to_jid.full()}) if subs_type == "subscribe": self.profiles[profile].presence.subscribe(to_jid) elif subs_type == "subscribed": @@ -721,9 +721,9 @@ def confirmationAnswer(self, conf_id, accepted, data, profile): """Called by frontends to answer confirmation requests""" client = self.getClient(profile) - log.debug(_("Received confirmation answer for conf_id [%(conf_id)s]: %(success)s") % {'conf_id': conf_id, 'success': _("accepted") if accepted else _("refused")}) + log.debug(_(u"Received confirmation answer for conf_id [%(conf_id)s]: %(success)s") % {'conf_id': conf_id, 'success': _("accepted") if accepted else _("refused")}) if conf_id not in client._waiting_conf: - log.error(_("Received an unknown confirmation (%(id)s for %(profile)s)") % {'id': conf_id, 'profile': profile}) + log.error(_(u"Received an unknown confirmation (%(id)s for %(profile)s)") % {'id': conf_id, 'profile': profile}) else: cb = client._waiting_conf[conf_id][-1] del client._waiting_conf[conf_id]