massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
This commit is contained in:
parent
cc829beac7
commit
67ff77e5de
2 changed files with 272 additions and 271 deletions
|
|
@ -162,7 +162,7 @@ class SAT(service.Service):
|
|||
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 @@ class SAT(service.Service):
|
|||
|
||||
"""
|
||||
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 @@ class SAT(service.Service):
|
|||
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 @@ class SAT(service.Service):
|
|||
|
||||
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 @@ class SAT(service.Service):
|
|||
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 @@ class SAT(service.Service):
|
|||
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]
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class SatXMPPClient(client.XMPPClient):
|
|||
disco_d.addCallback(finish_connection)
|
||||
|
||||
def initializationFailed(self, reason):
|
||||
log.error(_("ERROR: XMPP connection failed for profile '%(profile)s': %(reason)s" % {'profile': self.profile, 'reason': reason}))
|
||||
log.error(_(u"ERROR: XMPP connection failed for profile '%(profile)s': %(reason)s" % {'profile': self.profile, 'reason': reason}))
|
||||
self.conn_deferred.errback(reason.value)
|
||||
try:
|
||||
client.XMPPClient.initializationFailed(self, reason)
|
||||
|
|
@ -251,7 +251,7 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
|
|||
try:
|
||||
item = self._jids.pop(entity)
|
||||
except KeyError:
|
||||
log.error("Received a roster remove event for an item not in cache ({})".format(entity))
|
||||
log.error(u"Received a roster remove event for an item not in cache ({})".format(entity))
|
||||
return
|
||||
for group in item.groups:
|
||||
try:
|
||||
|
|
@ -260,7 +260,7 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
|
|||
if not jids_set:
|
||||
del self._groups[group]
|
||||
except KeyError:
|
||||
log.warning("there is no cache for the group [%(group)s] of the removed roster item [%(jid)s]" %
|
||||
log.warning(u"there is no cache for the group [%(group)s] of the removed roster item [%(jid)s]" %
|
||||
{"group": group, "jid": entity})
|
||||
|
||||
# then we send the bridge signal
|
||||
|
|
@ -309,7 +309,7 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
|
|||
super(SatPresenceProtocol, self).send(obj)
|
||||
|
||||
def availableReceived(self, entity, show=None, statuses=None, priority=0):
|
||||
log.debug(_("presence update for [%(entity)s] (available, show=%(show)s statuses=%(statuses)s priority=%(priority)d)") % {'entity': entity, C.PRESENCE_SHOW: show, C.PRESENCE_STATUSES: statuses, C.PRESENCE_PRIORITY: priority})
|
||||
log.debug(_(u"presence update for [%(entity)s] (available, show=%(show)s statuses=%(statuses)s priority=%(priority)d)") % {'entity': entity, C.PRESENCE_SHOW: show, C.PRESENCE_STATUSES: statuses, C.PRESENCE_PRIORITY: priority})
|
||||
|
||||
if not statuses:
|
||||
statuses = {}
|
||||
|
|
@ -328,7 +328,7 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
|
|||
self.parent.profile)
|
||||
|
||||
def unavailableReceived(self, entity, statuses=None):
|
||||
log.debug(_("presence update for [%(entity)s] (unavailable, statuses=%(statuses)s)") % {'entity': entity, C.PRESENCE_STATUSES: statuses})
|
||||
log.debug(_(u"presence update for [%(entity)s] (unavailable, statuses=%(statuses)s)") % {'entity': entity, C.PRESENCE_STATUSES: statuses})
|
||||
|
||||
if not statuses:
|
||||
statuses = {}
|
||||
|
|
@ -384,15 +384,15 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
|
|||
self.host.memory.delWaitingSub(entity.userhost(), self.parent.profile)
|
||||
|
||||
def subscribedReceived(self, entity):
|
||||
log.debug(_("subscription approved for [%s]") % entity.userhost())
|
||||
log.debug(_(u"subscription approved for [%s]") % entity.userhost())
|
||||
self.host.bridge.subscribe('subscribed', entity.userhost(), self.parent.profile)
|
||||
|
||||
def unsubscribedReceived(self, entity):
|
||||
log.debug(_("unsubscription confirmed for [%s]") % entity.userhost())
|
||||
log.debug(_(u"unsubscription confirmed for [%s]") % entity.userhost())
|
||||
self.host.bridge.subscribe('unsubscribed', entity.userhost(), self.parent.profile)
|
||||
|
||||
def subscribeReceived(self, entity):
|
||||
log.debug(_("subscription request from [%s]") % entity.userhost())
|
||||
log.debug(_(u"subscription request from [%s]") % entity.userhost())
|
||||
item = self.parent.roster.getItem(entity)
|
||||
if item and item.subscriptionTo:
|
||||
# We automatically accept subscription if we are already subscribed to contact presence
|
||||
|
|
@ -403,7 +403,7 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
|
|||
self.host.bridge.subscribe('subscribe', entity.userhost(), self.parent.profile)
|
||||
|
||||
def unsubscribeReceived(self, entity):
|
||||
log.debug(_("unsubscription asked for [%s]") % entity.userhost())
|
||||
log.debug(_(u"unsubscription asked for [%s]") % entity.userhost())
|
||||
item = self.parent.roster.getItem(entity)
|
||||
if item and item.subscriptionFrom: # we automatically remove contact
|
||||
log.debug(_('automatic contact deletion'))
|
||||
|
|
@ -438,10 +438,10 @@ class RegisteringAuthenticator(xmlstream.ConnectAuthenticator):
|
|||
self.user_email = email
|
||||
self.deferred = deferred
|
||||
self.profile = profile
|
||||
log.debug(_("Registration asked for %(user)s@%(host)s") % {'user': user_login, 'host': jabber_host})
|
||||
log.debug(_(u"Registration asked for %(user)s@%(host)s") % {'user': user_login, 'host': jabber_host})
|
||||
|
||||
def connectionMade(self):
|
||||
log.debug(_("Connection made with %s" % self.jabber_host))
|
||||
log.debug(_(u"Connection made with %s" % self.jabber_host))
|
||||
self.xmlstream.namespace = "jabber:client"
|
||||
self.xmlstream.sendHeader()
|
||||
|
||||
|
|
@ -459,11 +459,11 @@ class RegisteringAuthenticator(xmlstream.ConnectAuthenticator):
|
|||
d.chainDeferred(self.deferred)
|
||||
|
||||
def registrationAnswer(self, answer):
|
||||
log.debug(_("Registration answer: %s") % answer.toXml())
|
||||
log.debug(_(u"Registration answer: %s") % answer.toXml())
|
||||
self.xmlstream.sendFooter()
|
||||
|
||||
def registrationFailure(self, failure):
|
||||
log.info(_("Registration failure: %s") % str(failure.value))
|
||||
log.info(_("Registration failure: %s") % unicode(failure.value))
|
||||
self.xmlstream.sendFooter()
|
||||
raise failure.value
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue