Mercurial > libervia-backend
changeset 1409:3265a2639182
massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
line wrap: on
line diff
--- a/frontends/src/primitivus/primitivus Thu Apr 16 13:31:14 2015 +0200 +++ b/frontends/src/primitivus/primitivus Thu Apr 16 14:57:57 2015 +0200 @@ -348,7 +348,7 @@ try: config.applyConfig(self) except Exception as e: - log.error("configuration error: {}".format(e)) + log.error(u"configuration error: {}".format(e)) popup = sat_widgets.Alert(_("Configuration Error"), _("Something went wrong while reading the configuration, please check :messages"), ok_cb=self.removePopUp) if self.options.profile: self._early_popup = popup
--- a/frontends/src/quick_frontend/quick_app.py Thu Apr 16 13:31:14 2015 +0200 +++ b/frontends/src/quick_frontend/quick_app.py Thu Apr 16 14:57:57 2015 +0200 @@ -81,7 +81,7 @@ self.host.bridge.getEntitiesData([], ProfileManager.cache_keys_to_get, profile=self.profile, callback=self._plug_profile_gotCachedValues, errback=self._plug_profile_failedCachedValues) def _plug_profile_failedCachedValues(self, failure): - log.error("Couldn't get cached values: {}".format(failure)) + log.error(u"Couldn't get cached values: {}".format(failure)) self._plug_profile_gotCachedValues({}) def _plug_profile_gotCachedValues(self, cached_values): @@ -139,7 +139,7 @@ priority = presences[contact][res][1] statuses = presences[contact][res][2] self.host.presenceUpdateHandler(jabber_id, show, priority, statuses, self.profile) - self.host.bridge.getEntityData(contact, ['avatar', 'nick'], self.profile, callback=lambda data, contact=contact: gotEntityData(data, contact), errback=lambda failure, contact=contact: log.debug("No cache data for {}".format(contact))) + self.host.bridge.getEntityData(contact, ['avatar', 'nick'], self.profile, callback=lambda data, contact=contact: gotEntityData(data, contact), errback=lambda failure, contact=contact: log.debug(u"No cache data for {}".format(contact))) #Finaly, we get the waiting confirmation requests self.bridge.getWaitingConf(self.profile, callback=self._plug_profile_gotWaitingConf) @@ -510,7 +510,7 @@ def presenceUpdateHandler(self, entity_s, show, priority, statuses, profile): - log.debug(_("presence update for %(entity)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") + log.debug(_(u"presence update for %(entity)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") % {'entity': entity_s, C.PRESENCE_SHOW: show, C.PRESENCE_PRIORITY: priority, C.PRESENCE_STATUSES: statuses, 'profile': profile}) entity = jid.JID(entity_s) @@ -529,7 +529,7 @@ def roomJoinedHandler(self, room_jid_s, room_nicks, user_nick, profile): """Called when a MUC room is joined""" - log.debug("Room [%(room_jid)s] joined by %(profile)s, users presents:%(users)s" % {'room_jid': room_jid_s, 'profile': profile, 'users': room_nicks}) + log.debug(u"Room [%(room_jid)s] joined by %(profile)s, users presents:%(users)s" % {'room_jid': room_jid_s, 'profile': profile, 'users': room_nicks}) room_jid = jid.JID(room_jid_s) chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) chat_widget.setUserNick(unicode(user_nick)) @@ -538,7 +538,7 @@ def roomLeftHandler(self, room_jid_s, profile): """Called when a MUC room is left""" - log.debug("Room [%(room_jid)s] left by %(profile)s" % {'room_jid': room_jid_s, 'profile': profile}) + log.debug(u"Room [%(room_jid)s] left by %(profile)s" % {'room_jid': room_jid_s, 'profile': profile}) room_jid = jid.JID(room_jid_s) chat_widget = self.widgets.getWidget(quick_chat.QuickChat, room_jid, profile) if chat_widget: @@ -550,28 +550,28 @@ room_jid = jid.JID(room_jid_s) chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) chat_widget.addUser(user_nick) - log.debug("user [%(user_nick)s] joined room [%(room_jid)s]" % {'user_nick': user_nick, 'room_jid': room_jid}) + log.debug(u"user [%(user_nick)s] joined room [%(room_jid)s]" % {'user_nick': user_nick, 'room_jid': room_jid}) def roomUserLeftHandler(self, room_jid_s, user_nick, user_data, profile): """Called when an user joined a MUC room""" room_jid = jid.JID(room_jid_s) chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) chat_widget.removeUser(user_nick) - log.debug("user [%(user_nick)s] left room [%(room_jid)s]" % {'user_nick': user_nick, 'room_jid': room_jid}) + log.debug(u"user [%(user_nick)s] left room [%(room_jid)s]" % {'user_nick': user_nick, 'room_jid': room_jid}) def roomUserChangedNickHandler(self, room_jid_s, old_nick, new_nick, profile): """Called when an user joined a MUC room""" room_jid = jid.JID(room_jid_s) chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) chat_widget.changeUserNick(old_nick, new_nick) - log.debug("user [%(old_nick)s] is now known as [%(new_nick)s] in room [%(room_jid)s]" % {'old_nick': old_nick, 'new_nick': new_nick, 'room_jid': room_jid}) + log.debug(u"user [%(old_nick)s] is now known as [%(new_nick)s] in room [%(room_jid)s]" % {'old_nick': old_nick, 'new_nick': new_nick, 'room_jid': room_jid}) def roomNewSubjectHandler(self, room_jid_s, subject, profile): """Called when subject of MUC room change""" room_jid = jid.JID(room_jid_s) chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) chat_widget.setSubject(subject) - log.debug("new subject for room [%(room_jid)s]: %(subject)s" % {'room_jid': room_jid, "subject": subject}) + log.debug(u"new subject for room [%(room_jid)s]: %(subject)s" % {'room_jid': room_jid, "subject": subject}) def chatStateReceivedHandler(self, from_jid_s, state, profile): """Called when a new chat state (XEP-0085) is received. @@ -630,9 +630,9 @@ pass #FIXME def paramUpdateHandler(self, name, value, namespace, profile): - log.debug(_("param update: [%(namespace)s] %(name)s = %(value)s") % {'namespace': namespace, 'name': name, 'value': value}) + log.debug(_(u"param update: [%(namespace)s] %(name)s = %(value)s") % {'namespace': namespace, 'name': name, 'value': value}) if (namespace, name) == ("Connection", "JabberID"): - log.debug(_("Changing JID to %s") % value) + log.debug(_(u"Changing JID to %s") % value) self.profiles[profile].whoami = jid.JID(value) elif (namespace, name) == ("Misc", "Watched"): self.profiles[profile]['watched'] = value.split()
--- a/frontends/src/quick_frontend/quick_contact_list.py Thu Apr 16 13:31:14 2015 +0200 +++ b/frontends/src/quick_frontend/quick_contact_list.py Thu Apr 16 14:57:57 2015 +0200 @@ -363,7 +363,7 @@ try: groups = self._cache[entity_bare].get(C.CONTACT_GROUPS, set()) except KeyError: - log.warning(_("Trying to delete an unknow entity [{}]").format(entity)) + log.warning(_(u"Trying to delete an unknow entity [{}]").format(entity)) if in_roster: self._roster.remove(entity_bare) del self._cache[entity_bare] @@ -397,7 +397,7 @@ try: del cache[C.CONTACT_RESOURCES][entity.resource] except KeyError: - log.error("Presence unavailable received for an unknown resource [{}]".format(entity)) + log.error(u"Presence unavailable received for an unknown resource [{}]".format(entity)) if not cache[C.CONTACT_RESOURCES]: cache[C.CONTACT_MAIN_RESOURCE] = None else: @@ -432,7 +432,7 @@ @param entity(jid.JID): entity to select (resource is significant) """ - log.debug("select %s" % entity) + log.debug(u"select %s" % entity) self._selected.add(entity) self.update()
--- a/frontends/src/quick_frontend/quick_menus.py Thu Apr 16 13:31:14 2015 +0200 +++ b/frontends/src/quick_frontend/quick_menus.py Thu Apr 16 14:57:57 2015 +0200 @@ -205,7 +205,7 @@ raise KeyError(item) def getOrCreate(self, item): - log.debug("MenuContainer getOrCreate: item=%s name=%s\nlist=%s" % (item, item.canonical, self._items.keys())) + log.debug(u"MenuContainer getOrCreate: item=%s name=%s\nlist=%s" % (item, item.canonical, self._items.keys())) try: return self[item] except KeyError:
--- a/frontends/src/quick_frontend/quick_profile_manager.py Thu Apr 16 13:31:14 2015 +0200 +++ b/frontends/src/quick_frontend/quick_profile_manager.py Thu Apr 16 14:57:57 2015 +0200 @@ -178,11 +178,11 @@ if login != self.current.login and self.current.login is not None: self.current.login = login self.host.bridge.setParam("JabberID", login, "Connection", profile_key=self.current.profile) - log.info("login updated for profile [{}]".format(self.current.profile)) + log.info(u"login updated for profile [{}]".format(self.current.profile)) if password != self.current.password and self.current.password is not None: self.current.password = password self.host.bridge.setParam("Password", password, "Connection", profile_key=self.current.profile) - log.info("password updated for profile [{}]".format(self.current.profile)) + log.info(u"password updated for profile [{}]".format(self.current.profile)) ## graphic updates (should probably be overriden in frontends) ##
--- 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]
--- a/src/core/xmpp.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/core/xmpp.py Thu Apr 16 14:57:57 2015 +0200 @@ -84,7 +84,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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
--- a/src/memory/disco.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/memory/disco.py Thu Apr 16 14:57:57 2015 +0200 @@ -131,9 +131,9 @@ # we cache items only for our own server try: items = self.host.memory.getEntityData(jid_, ["DISCO_ITEMS"], client.profile)["DISCO_ITEMS"] - log.debug("[%s] disco items are in cache" % jid_.full()) + log.debug(u"[%s] disco items are in cache" % jid_.full()) except (KeyError, exceptions.UnknownEntityError): - log.debug("Caching [%s] disco items" % jid_.full()) + log.debug(u"Caching [%s] disco items" % jid_.full()) items = yield client.disco.requestItems(jid_, nodeIdentifier) self.host.memory.updateEntityData(jid_, "DISCO_ITEMS", items, profile_key=client.profile) else: @@ -144,7 +144,7 @@ def _infosEb(self, failure, entity_jid): failure.trap(StanzaError) - log.warning(_("Error while requesting [%(jid)s]: %(error)s") % {'jid': entity_jid.full(), + log.warning(_(u"Error while requesting [%(jid)s]: %(error)s") % {'jid': entity_jid.full(), 'error': failure.getErrorMessage()}) def findServiceEntities(self, category, type_, jid_=None, profile_key=C.PROF_KEY_NONE): @@ -243,7 +243,7 @@ s.append('<') #TODO: manage XEP-0128 data form here cap_hash = b64encode(sha1(''.join(s)).digest()) - log.debug(_('Capability hash generated: [%s]') % cap_hash) + log.debug(_(u'Capability hash generated: [%s]') % cap_hash) return cap_hash @defer.inlineCallbacks
--- a/src/memory/memory.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/memory/memory.py Thu Apr 16 14:57:57 2015 +0200 @@ -66,7 +66,7 @@ session_id = str(uuid4()) elif session_id in self._sessions: self._sessions[session_id][0].cancel() - log.warning("Session [{id}] is going to be re-initialised".format(id=session_id)) + log.warning(u"Session [{id}] is going to be re-initialised".format(id=session_id)) timer = reactor.callLater(self.timeout, self._purgeSession, session_id) if session_data is None: session_data = {} @@ -75,7 +75,7 @@ def _purgeSession(self, session_id): del self._sessions[session_id] - log.debug("Session [%s] purged" % session_id) + log.debug(u"Session [%s] purged" % session_id) def __len__(self): return len(self._sessions) @@ -113,7 +113,7 @@ timer.cancel() self._purgeSession(session_id) except KeyError: - log.debug("Session [%s] doesn't exists, timeout expired?" % session_id) + log.debug(u"Session [%s] doesn't exists, timeout expired?" % session_id) def keys(self): return self._sessions.keys() @@ -204,7 +204,7 @@ old_default = '~/.sat' if os.path.isfile(os.path.expanduser(old_default) + '/' + C.SAVEFILE_DATABASE): if not silent: - log.warning(_("A database has been found in the default local_dir for previous versions (< 0.5)")) + log.warning(_(u"A database has been found in the default local_dir for previous versions (< 0.5)")) tools_config.fixConfigOption('', 'local_dir', old_default, silent) @@ -269,10 +269,10 @@ if os.path.exists(filename): try: self.params.load_xml(filename) - log.debug(_("Parameters loaded from file: %s") % filename) + log.debug(_(u"Parameters loaded from file: %s") % filename) return True except Exception as e: - log.error(_("Can't load parameters from file: %s") % e) + log.error(_(u"Can't load parameters from file: %s") % e) return False def save_xml(self, filename): @@ -287,10 +287,10 @@ filename = os.path.expanduser(filename) try: self.params.save_xml(filename) - log.debug(_("Parameters saved to file: %s") % filename) + log.debug(_(u"Parameters saved to file: %s") % filename) return True except Exception as e: - log.error(_("Can't save parameters to file: %s") % e) + log.error(_(u"Can't save parameters to file: %s") % e) return False def load(self): @@ -323,7 +323,7 @@ def gotPersonalKey(personal_key): """Create the session for this profile and store the personal key""" self.auth_sessions.newSession({C.MEMORY_CRYPTO_KEY: personal_key}, profile=profile) - log.debug('auth session created for profile %s' % profile) + log.debug(u'auth session created for profile %s' % profile) d = PersistentDict(C.MEMORY_CRYPTO_NAMESPACE, profile).load() d.addCallback(lambda data: BlockCipher.decrypt(key, data[C.MEMORY_CRYPTO_KEY])) @@ -337,7 +337,7 @@ try: del self._entities_cache[profile] except KeyError: - log.error(_("Trying to purge roster status cache for a profile not in memory: [%s]") % profile) + log.error(_(u"Trying to purge roster status cache for a profile not in memory: [%s]") % profile) def getProfilesList(self): return self.storage.getProfilesList() @@ -495,7 +495,7 @@ try: presence_data = self.getEntityDatum(full_jid, "presence", profile_key) except KeyError: - log.debug("Can't get presence data for {}".format(full_jid)) + log.debug(u"Can't get presence data for {}".format(full_jid)) else: if presence_data.show != C.PRESENCE_UNAVAILABLE: available.append(resource) @@ -527,13 +527,13 @@ try: presence_data = self.getEntityDatum(full_jid, "presence", profile_key) except KeyError: - log.debug("No presence information for {}".format(full_jid)) + log.debug(u"No presence information for {}".format(full_jid)) continue priority_resources.append((resource, presence_data.priority)) try: return max(priority_resources, key=lambda res_tuple: res_tuple[1])[0] except ValueError: - log.warning("No resource found at all for {}".format(entity_jid)) + log.warning(u"No resource found at all for {}".format(entity_jid)) return None ## Entities data ## @@ -801,7 +801,7 @@ return d.addCallback(cb) def done(dummy): - log.debug(_('Personal data (%(ns)s, %(key)s) has been successfuly encrypted') % + log.debug(_(u'Personal data (%(ns)s, %(key)s) has been successfuly encrypted') % {'ns': C.MEMORY_CRYPTO_NAMESPACE, 'key': data_key}) d = PersistentDict(C.MEMORY_CRYPTO_NAMESPACE, profile).load() @@ -887,6 +887,6 @@ try: presence_data = self.getEntityDatum(entity_jid, "presence", profile_key) except KeyError: - log.debug("No presence information for {}".format(entity_jid)) + log.debug(u"No presence information for {}".format(entity_jid)) return False return presence_data.show != C.PRESENCE_UNAVAILABLE
--- a/src/memory/params.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/memory/params.py Thu Apr 16 14:57:57 2015 +0200 @@ -132,7 +132,7 @@ try: del self.params[profile] except KeyError: - log.error(_("Trying to purge cache of a profile not in memory: [%s]") % profile) + log.error(_(u"Trying to purge cache of a profile not in memory: [%s]") % profile) def save_xml(self, filename): """Save parameters template to xml file""" @@ -202,7 +202,7 @@ elif return_profile_keys and profile_key in ["@ALL@"]: return profile_key # this value must be managed by the caller if not self.storage.hasProfile(profile_key): - log.error(_('Trying to access an unknown profile (%s)') % profile_key) + log.error(_(u'Trying to access an unknown profile (%s)') % profile_key) return "" # FIXME: raise exceptions.ProfileUnknownError here (must be well checked, this method is used in lot of places) return profile_key @@ -283,23 +283,23 @@ @param app: name of the frontend registering the parameters """ if not app: - log.warning(_("Trying to register frontends parameters with no specified app: aborted")) + log.warning(_(u"Trying to register frontends parameters with no specified app: aborted")) return if not hasattr(self, "frontends_cache"): self.frontends_cache = [] if app in self.frontends_cache: - log.debug(_("Trying to register twice frontends parameters for %(app)s: aborted" % {"app": app})) + log.debug(_(u"Trying to register twice frontends parameters for %(app)s: aborted" % {"app": app})) return self.frontends_cache.append(app) self.updateParams(xml, security_limit, app) - log.debug("Frontends parameters registered for %(app)s" % {'app': app}) + log.debug(u"Frontends parameters registered for %(app)s" % {'app': app}) def __default_ok(self, value, name, category): #FIXME: will not work with individual parameters self.setParam(name, value, category) def __default_ko(self, failure, name, category): - log.error(_("Can't determine default value for [%(category)s/%(name)s]: %(reason)s") % {'category': category, 'name': name, 'reason': str(failure.value)}) + log.error(_(u"Can't determine default value for [%(category)s/%(name)s]: %(reason)s") % {'category': category, 'name': name, 'reason': str(failure.value)}) def setDefault(self, name, category, callback, errback=None): """Set default value of parameter @@ -314,7 +314,7 @@ log.debug ("setDefault called for %(category)s/%(name)s" % {"category": category, "name": name}) node = self._getParamNode(name, category, '@ALL@') if not node: - log.error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category}) + log.error(_(u"Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category}) return if node[1].getAttribute('default_cb') == 'yes': # del node[1].attributes['default_cb'] # default_cb is not used anymore as a flag to know if we have to set the default value, @@ -354,9 +354,9 @@ {'cat': cat, 'param': param, 'value': value_to_use}) return value_to_use if len(selected) == 0: - log.error(_('Parameter (%(cat)s, %(param)s) of type list has no default option!') % {'cat': cat, 'param': param}) + log.error(_(u'Parameter (%(cat)s, %(param)s) of type list has no default option!') % {'cat': cat, 'param': param}) else: - log.error(_('Parameter (%(cat)s, %(param)s) of type list has more than one default option!') % {'cat': cat, 'param': param}) + log.error(_(u'Parameter (%(cat)s, %(param)s) of type list has more than one default option!') % {'cat': cat, 'param': param}) raise exceptions.DataError return value_to_use return node.getAttribute(attr) @@ -432,7 +432,7 @@ #FIXME: looks really dirty and buggy, need to be reviewed/refactored node = self._getParamNode(name, category) if not node: - log.error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category}) + log.error(_(u"Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category}) raise exceptions.NotFound if attr == 'value' and node[1].getAttribute('type') == 'password': @@ -472,11 +472,11 @@ """ node = self._getParamNode(name, category) if not node: - log.error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category}) + log.error(_(u"Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category}) raise ValueError("Requested param doesn't exist") if not self.checkSecurityLimit(node[1], security_limit): - log.warning(_("Trying to get parameter '%(param)s' in category '%(cat)s' without authorization!!!" + log.warning(_(u"Trying to get parameter '%(param)s' in category '%(cat)s' without authorization!!!" % {'param': name, 'cat': category})) raise exceptions.PermissionError @@ -736,17 +736,17 @@ if profile_key != C.PROF_KEY_NONE: profile = self.getProfileName(profile_key) if not profile: - log.error(_('Trying to set parameter for an unknown profile')) + log.error(_(u'Trying to set parameter for an unknown profile')) raise exceptions.ProfileUnknownError node = self._getParamNode(name, category, '@ALL@') if not node: - log.error(_('Requesting an unknown parameter (%(category)s/%(name)s)') + log.error(_(u'Requesting an unknown parameter (%(category)s/%(name)s)') % {'category': category, 'name': name}) return defer.succeed(None) if not self.checkSecurityLimit(node[1], security_limit): - log.warning(_("Trying to set parameter '%(param)s' in category '%(cat)s' without authorization!!!" + log.warning(_(u"Trying to set parameter '%(param)s' in category '%(cat)s' without authorization!!!" % {'param': name, 'cat': category})) return defer.succeed(None) @@ -758,7 +758,7 @@ try: int(value) except ValueError: - log.debug(_("Trying to set parameter '%(param)s' in category '%(cat)s' with an non-integer value" + log.debug(_(u"Trying to set parameter '%(param)s' in category '%(cat)s' with an non-integer value" % {'param': name, 'cat': category})) return defer.succeed(None) if node[1].hasAttribute("constraint"): @@ -786,7 +786,7 @@ d_list = [] if type_ == "button": - log.debug("Clicked param button %s" % node.toxml()) + log.debug(u"Clicked param button %s" % node.toxml()) return defer.succeed(None) d = defer.succeed(value) if type_ == "password":
--- a/src/memory/sqlite.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/memory/sqlite.py Thu Apr 16 14:57:57 2015 +0200 @@ -114,7 +114,7 @@ if statements is None: return defer.succeed(None) - log.debug("===== COMMITING STATEMENTS =====\n%s\n============\n\n" % '\n'.join(statements)) + log.debug(u"===== COMMITING STATEMENTS =====\n%s\n============\n\n" % '\n'.join(statements)) d = self.dbpool.runInteraction(self._updateDb, tuple(statements)) return d @@ -170,7 +170,7 @@ @param name: name of the profile @return: deferred triggered once profile is actually deleted""" def deletionError(failure): - log.error(_("Can't delete profile [%s]") % name) + log.error(_(u"Can't delete profile [%s]") % name) return failure def delete(txn): @@ -194,7 +194,7 @@ for param in result: category, name, value = param params_gen[(category, name)] = value - log.debug(_("loading general parameters from database")) + log.debug(_(u"loading general parameters from database")) return self.dbpool.runQuery("SELECT category,name,value FROM param_gen").addCallback(fillParams) def loadIndParams(self, params_ind, profile): @@ -207,7 +207,7 @@ for param in result: category, name, value = param params_ind[(category, name)] = value - log.debug(_("loading individual parameters from database")) + log.debug(_(u"loading individual parameters from database")) d = self.dbpool.runQuery("SELECT category,name,value FROM param_ind WHERE profile_id=?", (self.profiles[profile], )) d.addCallback(fillParams) return d @@ -229,7 +229,7 @@ @param value: value to set @return: deferred""" d = self.dbpool.runQuery("REPLACE INTO param_gen(category,name,value) VALUES (?,?,?)", (category, name, value)) - d.addErrback(lambda ignore: log.error(_("Can't set general parameter (%(category)s/%(name)s) in database" % {"category": category, "name": name}))) + d.addErrback(lambda ignore: log.error(_(u"Can't set general parameter (%(category)s/%(name)s) in database" % {"category": category, "name": name}))) return d def setIndParam(self, category, name, value, profile): @@ -240,7 +240,7 @@ @param profile: a profile which *must* exist @return: deferred""" d = self.dbpool.runQuery("REPLACE INTO param_ind(category,name,profile_id,value) VALUES (?,?,?,?)", (category, name, self.profiles[profile], value)) - d.addErrback(lambda ignore: log.error(_("Can't set individual parameter (%(category)s/%(name)s) for [%(profile)s] in database" % {"category": category, "name": name, "profile": profile}))) + d.addErrback(lambda ignore: log.error(_(u"Can't set individual parameter (%(category)s/%(name)s) for [%(profile)s] in database" % {"category": category, "name": name, "profile": profile}))) return d #History @@ -260,7 +260,7 @@ d = self.dbpool.runQuery("INSERT INTO history(source, source_res, dest, dest_res, timestamp, message, type, extra, profile_id) VALUES (?,?,?,?,?,?,?,?,?)", (from_jid.userhost(), from_jid.resource, to_jid.userhost(), to_jid.resource, timestamp or time(), message, _type, extra_, self.profiles[profile])) - d.addErrback(lambda ignore: log.error(_("Can't save following message in history: from [%(from_jid)s] to [%(to_jid)s] ==> [%(message)s]" % + d.addErrback(lambda ignore: log.error(_(u"Can't save following message in history: from [%(from_jid)s] to [%(to_jid)s] ==> [%(message)s]" % {"from_jid": from_jid.full(), "to_jid": to_jid.full(), "message": message}))) return d @@ -337,9 +337,9 @@ for private in result: key, value = private private_gen[key] = value - log.debug(_("loading general private values [namespace: %s] from database") % (namespace, )) + log.debug(_(u"loading general private values [namespace: %s] from database") % (namespace,)) d = self.dbpool.runQuery("SELECT key,value FROM private_gen WHERE namespace=?", (namespace, )).addCallback(fillPrivates) - return d.addErrback(lambda x: log.debug(_("No data present in database for namespace %s") % namespace)) + return d.addErrback(lambda x: log.debug(_(u"No data present in database for namespace %s") % namespace)) def loadIndPrivates(self, private_ind, namespace, profile): """Load individual private values @@ -352,10 +352,10 @@ for private in result: key, value = private private_ind[key] = value - log.debug(_("loading individual private values [namespace: %s] from database") % (namespace, )) + log.debug(_(u"loading individual private values [namespace: %s] from database") % (namespace,)) d = self.dbpool.runQuery("SELECT key,value FROM private_ind WHERE namespace=? AND profile_id=?", (namespace, self.profiles[profile])) d.addCallback(fillPrivates) - return d.addErrback(lambda x: log.debug(_("No data present in database for namespace %s") % namespace)) + return d.addErrback(lambda x: log.debug(_(u"No data present in database for namespace %s") % namespace)) def setGenPrivate(self, namespace, key, value): """Save the general private value in database @@ -364,7 +364,7 @@ @param value: value to set @return: deferred""" d = self.dbpool.runQuery("REPLACE INTO private_gen(namespace,key,value) VALUES (?,?,?)", (namespace, key, value)) - d.addErrback(lambda ignore: log.error(_("Can't set general private value (%(key)s) [namespace:%(namespace)s] in database" % + d.addErrback(lambda ignore: log.error(_(u"Can't set general private value (%(key)s) [namespace:%(namespace)s] in database" % {"namespace": namespace, "key": key}))) return d @@ -376,7 +376,7 @@ @param profile: a profile which *must* exist @return: deferred""" d = self.dbpool.runQuery("REPLACE INTO private_ind(namespace,key,profile_id,value) VALUES (?,?,?,?)", (namespace, key, self.profiles[profile], value)) - d.addErrback(lambda ignore: log.error(_("Can't set individual private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" % + d.addErrback(lambda ignore: log.error(_(u"Can't set individual private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" % {"namespace": namespace, "key": key, "profile": profile}))) return d @@ -386,7 +386,7 @@ @param key: key of the private value @return: deferred""" d = self.dbpool.runQuery("DELETE FROM private_gen WHERE namespace=? AND key=?", (namespace, key)) - d.addErrback(lambda ignore: log.error(_("Can't delete general private value (%(key)s) [namespace:%(namespace)s] in database" % + d.addErrback(lambda ignore: log.error(_(u"Can't delete general private value (%(key)s) [namespace:%(namespace)s] in database" % {"namespace": namespace, "key": key}))) return d @@ -397,7 +397,7 @@ @param profile: a profile which *must* exist @return: deferred""" d = self.dbpool.runQuery("DELETE FROM private_ind WHERE namespace=? AND key=? AND profile=?)", (namespace, key, self.profiles[profile])) - d.addErrback(lambda ignore: log.error(_("Can't delete individual private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" % + d.addErrback(lambda ignore: log.error(_(u"Can't delete individual private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" % {"namespace": namespace, "key": key, "profile": profile}))) return d @@ -411,9 +411,9 @@ for private in result: key, value = private private_gen[key] = pickle.loads(str(value)) - log.debug(_("loading general private binary values [namespace: %s] from database") % (namespace, )) + log.debug(_(u"loading general private binary values [namespace: %s] from database") % (namespace,)) d = self.dbpool.runQuery("SELECT key,value FROM private_gen_bin WHERE namespace=?", (namespace, )).addCallback(fillPrivates) - return d.addErrback(lambda x: log.debug(_("No binary data present in database for namespace %s") % namespace)) + return d.addErrback(lambda x: log.debug(_(u"No binary data present in database for namespace %s") % namespace)) def loadIndPrivatesBinary(self, private_ind, namespace, profile): """Load individual private binary values @@ -426,10 +426,10 @@ for private in result: key, value = private private_ind[key] = pickle.loads(str(value)) - log.debug(_("loading individual private binary values [namespace: %s] from database") % (namespace, )) + log.debug(_(u"loading individual private binary values [namespace: %s] from database") % (namespace,)) d = self.dbpool.runQuery("SELECT key,value FROM private_ind_bin WHERE namespace=? AND profile_id=?", (namespace, self.profiles[profile])) d.addCallback(fillPrivates) - return d.addErrback(lambda x: log.debug(_("No binary data present in database for namespace %s") % namespace)) + return d.addErrback(lambda x: log.debug(_(u"No binary data present in database for namespace %s") % namespace)) def setGenPrivateBinary(self, namespace, key, value): """Save the general private binary value in database @@ -438,7 +438,7 @@ @param value: value to set @return: deferred""" d = self.dbpool.runQuery("REPLACE INTO private_gen_bin(namespace,key,value) VALUES (?,?,?)", (namespace, key, pickle.dumps(value, 0))) - d.addErrback(lambda ignore: log.error(_("Can't set general private binary value (%(key)s) [namespace:%(namespace)s] in database" % + d.addErrback(lambda ignore: log.error(_(u"Can't set general private binary value (%(key)s) [namespace:%(namespace)s] in database" % {"namespace": namespace, "key": key}))) return d @@ -450,7 +450,7 @@ @param profile: a profile which *must* exist @return: deferred""" d = self.dbpool.runQuery("REPLACE INTO private_ind_bin(namespace,key,profile_id,value) VALUES (?,?,?,?)", (namespace, key, self.profiles[profile], pickle.dumps(value, 0))) - d.addErrback(lambda ignore: log.error(_("Can't set individual binary private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" % + d.addErrback(lambda ignore: log.error(_(u"Can't set individual binary private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" % {"namespace": namespace, "key": key, "profile": profile}))) return d @@ -460,7 +460,7 @@ @param key: key of the private value @return: deferred""" d = self.dbpool.runQuery("DELETE FROM private_gen_bin WHERE namespace=? AND key=?", (namespace, key)) - d.addErrback(lambda ignore: log.error(_("Can't delete general private binary value (%(key)s) [namespace:%(namespace)s] in database" % + d.addErrback(lambda ignore: log.error(_(u"Can't delete general private binary value (%(key)s) [namespace:%(namespace)s] in database" % {"namespace": namespace, "key": key}))) return d @@ -471,7 +471,7 @@ @param profile: a profile which *must* exist @return: deferred""" d = self.dbpool.runQuery("DELETE FROM private_ind_bin WHERE namespace=? AND key=? AND profile=?)", (namespace, key, self.profiles[profile])) - d.addErrback(lambda ignore: log.error(_("Can't delete individual private binary value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" % + d.addErrback(lambda ignore: log.error(_(u"Can't delete individual private binary value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" % {"namespace": namespace, "key": key, "profile": profile}))) return d ##Helper methods## @@ -781,7 +781,7 @@ try: id_ = result[0][0] except IndexError: - log.error("Profile of id %d is referenced in 'param_ind' but it doesn't exist!" % profile_id) + log.error(u"Profile of id %d is referenced in 'param_ind' but it doesn't exist!" % profile_id) return defer.succeed(None) sat_password = xmpp_password
--- a/src/plugins/plugin_exp_command_export.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_exp_command_export.py Thu Apr 16 14:57:57 2015 +0200 @@ -142,7 +142,7 @@ """ profile = self.host.memory.getProfileName(profile_key) if not profile: - log.warning("Unknown profile [%s]" % (profile,)) + log.warning(u"Unknown profile [%s]" % (profile,)) return for target in targets:
--- a/src/plugins/plugin_exp_parrot.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_exp_parrot.py Thu Apr 16 14:57:57 2015 +0200 @@ -118,7 +118,7 @@ _links = client.parrot_links = {} _links[source_jid.userhostJID()] = dest_jid - log.info("Parrot mode: %s will be repeated to %s" % (source_jid.userhost(), unicode(dest_jid))) + log.info(u"Parrot mode: %s will be repeated to %s" % (source_jid.userhost(), unicode(dest_jid))) def removeParrot(self, source_jid, profile): """Remove parrot link
--- a/src/plugins/plugin_exp_pipe.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_exp_pipe.py Thu Apr 16 14:57:57 2015 +0200 @@ -68,7 +68,7 @@ client = self.host.getClient(profile) del client._pipe_waiting_for_approval[approval_id] except KeyError: - log.warning(_("kill id called on a non existant approval id")) + log.warning(_(u"kill id called on a non existant approval id")) def transferRequest(self, iq_id, from_jid, si_id, si_mime_type, si_el, profile): """Called when a pipe transfer is requested @@ -85,7 +85,7 @@ feature_elts = self.host.plugins["XEP-0020"].getFeatureElt(si_el) if not pipe_elts: - log.warning(_("No pipe element found")) + log.warning(_(u"No pipe element found")) self.host.plugins["XEP-0095"].sendBadRequestError(iq_id, from_jid, profile) return @@ -95,15 +95,15 @@ try: stream_method = self.host.plugins["XEP-0020"].negociate(feature_el, 'stream-method', self.managed_stream_m) except KeyError: - log.warning(_("No stream method found")) + log.warning(_(u"No stream method found")) self.host.plugins["XEP-0095"].sendBadRequestError(iq_id, from_jid, profile) return if not stream_method: - log.warning(_("Can't find a valid stream method")) + log.warning(_(u"Can't find a valid stream method")) self.host.plugins["XEP-0095"].sendFailedError(iq_id, from_jid, profile) return else: - log.warning(_("No feature element found")) + log.warning(_(u"No feature element found")) self.host.plugins["XEP-0095"].sendBadRequestError(iq_id, from_jid, profile) return @@ -126,7 +126,7 @@ try: dest_path = frontend_data['dest_path'] except KeyError: - log.error(_('dest path not found in frontend_data')) + log.error(_(u'dest path not found in frontend_data')) del(client._pipe_waiting_for_approval[sid]) return if stream_method == self.host.plugins["XEP-0065"].NAMESPACE: @@ -136,7 +136,7 @@ file_obj = open(dest_path, 'w+') self.host.plugins["XEP-0047"].prepareToReceive(jid.JID(data['from']), sid, file_obj, None, self._transferSucceeded, self._transferFailed, profile) 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")) del(client._pipe_waiting_for_approval[sid]) return @@ -146,7 +146,7 @@ misc_elts.append(domish.Element((PROFILE, "file"))) 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._pipe_waiting_for_approval[sid]) @@ -164,41 +164,41 @@ @param reason: can be TIMEOUT, IO_ERROR, PROTOCOL_ERROR""" client = self.host.getClient(profile) data, timeout, stream_method, failed_methods, profile = client._pipe_waiting_for_approval[sid] - log.warning(_('Transfer %(id)s failed with stream method %(s_method)s') % {'id': sid, + log.warning(_(u'Transfer %(id)s failed with stream method %(s_method)s') % {'id': sid, 's_method': stream_method}) # filepath = file_obj.name file_obj.close() #TODO: session remenber (within a time limit) when a stream method fail, and avoid that stream method with full jid for the rest of the session - log.warning(_("All stream methods failed, can't transfer the file")) + log.warning(_(u"All stream methods failed, can't transfer the file")) del(client._pipe_waiting_for_approval[sid]) def pipeCb(self, filepath, sid, profile, IQ): if IQ['type'] == "error": stanza_err = jabber.error.exceptionFromStanza(IQ) if stanza_err.code == '403' and stanza_err.condition == 'forbidden': - log.debug(_("Pipe transfer refused by %s") % IQ['from']) + log.debug(_(u"Pipe transfer refused by %s") % IQ['from']) self.host.bridge.newAlert(_("The contact %s refused your pipe stream") % IQ['from'], _("Pipe stream refused"), "INFO", profile) else: - log.warning(_("Error during pipe stream transfer with %s") % IQ['from']) + log.warning(_(u"Error during pipe stream transfer with %s") % IQ['from']) self.host.bridge.newAlert(_("Something went wrong during the pipe stream session intialisation with %s") % IQ['from'], _("Pipe stream error"), "ERROR", profile) return si_elt = IQ.firstChildElement() if IQ['type'] != "result" or not si_elt or si_elt.name != "si": - log.error(_("Protocol error during file transfer")) + log.error(_(u"Protocol error during file transfer")) return feature_elts = self.host.plugins["XEP-0020"].getFeatureElt(si_elt) if not feature_elts: - log.warning(_("No feature element")) + log.warning(_(u"No feature element")) return choosed_options = self.host.plugins["XEP-0020"].getChoosedOptions(feature_elts[0]) try: stream_method = choosed_options["stream-method"] except KeyError: - log.warning(_("No stream method choosed")) + log.warning(_(u"No stream method choosed")) return if stream_method == self.host.plugins["XEP-0065"].NAMESPACE: @@ -212,7 +212,7 @@ file_obj = open(filepath, 'r') # XXX: we have to be sure that filepath is well opened, as reading can block it self.host.plugins["XEP-0047"].startStream(file_obj, jid.JID(IQ['from']), sid, None, self.sendSuccessCb, self.sendFailureCb, None, profile) else: - log.warning(_("Invalid stream method received")) + log.warning(_(u"Invalid stream method received")) def pipeOut(self, to_jid, filepath, data={}, profile_key=C.PROF_KEY_NONE): """send a file using EXP-PIPE @@ -224,7 +224,7 @@ """ profile = self.host.memory.getProfileName(profile_key) if not profile: - log.warning(_("Trying to send a file from an unknown profile")) + log.warning(_(u"Trying to send a file from an unknown profile")) return "" feature_elt = self.host.plugins["XEP-0020"].proposeFeatures({'stream-method': self.managed_stream_m}) @@ -243,4 +243,4 @@ 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 %(profile)s') % {'id': sid, "s_method": stream_method, "profile": profile}) + log.warning(_(u'Transfer %(id)s failed with stream method %(s_method)s %(profile)s') % {'id': sid, "s_method": stream_method, "profile": profile})
--- a/src/plugins/plugin_misc_account.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_misc_account.py Thu Apr 16 14:57:57 2015 +0200 @@ -131,10 +131,10 @@ if self._prosody_path is None: paths = which(self.getConfig('prosodyctl')) if not paths: - log.error(_("Can't find %s") % (self.getConfig('prosodyctl'), )) + log.error(_(u"Can't find %s") % (self.getConfig('prosodyctl'),)) else: self._prosody_path = dirname(paths[0]) - log.info(_('Prosody path found: %s') % (self._prosody_path, )) + log.info(_(u'Prosody path found: %s') % (self._prosody_path,)) self._sessions = Sessions() @@ -213,7 +213,7 @@ def email_ko(ignore): #TODO: return error code to user - log.error("Failed to send email to %s" % email) + log.error(u"Failed to send email to %s" % email) body = (u"""Welcome to Libervia, a Salut à Toi project part
--- a/src/plugins/plugin_misc_groupblog.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_misc_groupblog.py Thu Apr 16 14:57:57 2015 +0200 @@ -164,12 +164,12 @@ # item_access_pubsubs = yield self.host.findFeaturesSet((NS_PUBSUB_ITEM_ACCESS, NS_PUBSUB_AUTO_CREATE, NS_PUBSUB_CREATOR_JID_CHECK), "pubsub", "service", profile_key=profile) try: client.item_access_pubsub = item_access_pubsubs.pop() - log.info(_("item-access powered pubsub service found: [%s]") % client.item_access_pubsub.full()) + log.info(_(u"item-access powered pubsub service found: [%s]") % client.item_access_pubsub.full()) except KeyError: client.item_access_pubsub = None if not client.item_access_pubsub: - log.error(_("No item-access powered pubsub server found, can't use group blog")) + log.error(_(u"No item-access powered pubsub server found, can't use group blog")) raise NoCompatiblePubSubServerFound defer.returnValue((profile, client)) @@ -187,7 +187,7 @@ if (not (origin_host) or len(event_host) < len(origin_host) or event_host[-len(origin_host):] != origin_host): - log.warning("Host incoherence between %s and %s (hack attempt ?)" % (unicode(event.sender), + log.warning(u"Host incoherence between %s and %s (hack attempt ?)" % (unicode(event.sender), unicode(publisher))) return False @@ -398,10 +398,10 @@ # remove the associated comments node comments_service, comments_node = self.host.plugins["XEP-0277"].parseCommentUrl(comments) d = self.host.plugins["XEP-0060"].deleteNode(comments_service, comments_node, profile_key=profile) - d.addErrback(lambda failure: log.error("Deletion of node %s failed: %s" % (comments_node, failure.getErrorMessage()))) + d.addErrback(lambda failure: log.error(u"Deletion of node %s failed: %s" % (comments_node, failure.getErrorMessage()))) # remove the item itself d = self.host.plugins["XEP-0060"].retractItems(service_jid, node, [item_id], profile_key=profile) - d.addErrback(lambda failure: log.error("Deletion of item %s from %s failed: %s" % (item_id, node, failure.getErrorMessage()))) + d.addErrback(lambda failure: log.error(u"Deletion of item %s from %s failed: %s" % (item_id, node, failure.getErrorMessage()))) return d def notify(d): @@ -450,7 +450,7 @@ self.__fillCommentsElement(mblog_data, entry_id, node, service_jid) entry_d = self.host.plugins["XEP-0277"].data2entry(mblog_data, profile) entry_d.addCallback(lambda mblog_item: self.host.plugins["XEP-0060"].publish(service_jid, node, items=[mblog_item], profile_key=profile)) - entry_d.addErrback(lambda failure: log.error("Modification of %s failed: %s" % (pub_data, failure.getErrorMessage()))) + entry_d.addErrback(lambda failure: log.error(u"Modification of %s failed: %s" % (pub_data, failure.getErrorMessage()))) return entry_d return self._initialise(profile_key).addCallback(initialised) @@ -494,14 +494,14 @@ try: gbdata['service'] = client.item_access_pubsub.full() except AttributeError: - log.warning(_("Pubsub service is unknown for blog entry %s") % gbdata['id']) + log.warning(_(u"Pubsub service is unknown for blog entry %s") % gbdata['id']) # every comments node must be subscribed, except if we are the publisher (we are already subscribed in this case) if "comments_node" in gbdata and pub_jid.userhostJID() != client.jid.userhostJID(): try: service = jid.JID(gbdata["comments_service"]) node = gbdata["comments_node"] except KeyError: - log.error(_("Missing key for blog comment %s") % gbdata['id']) + log.error(_(u"Missing key for blog comment %s") % gbdata['id']) defer.returnValue(gbdata) # TODO: see if it is really needed to check for not subscribing twice to the node # It previously worked without this check, but the pubsub service logs were polluted @@ -766,14 +766,14 @@ d_list = [] for node in [node for node in nodes if node.endswith(main_node)]: d = self.host.plugins["XEP-0060"].deleteNode(service, node, profile_key=profile) - d.addErrback(lambda failure: log.error(_("Deletion of node %(node)s failed: %(message)s") % + d.addErrback(lambda failure: log.error(_(u"Deletion of node %(node)s failed: %(message)s") % {'node': node, 'message': failure.getErrorMessage()})) d_list.append(d) return defer.DeferredList(d_list) d = self.host.plugins["XEP-0060"].listNodes(service, profile=profile) d.addCallback(cb) - d.addCallback(lambda dummy: log.info(_("All microblog's main items from %s have been deleted!") % jid_.userhost())) + d.addCallback(lambda dummy: log.info(_(u"All microblog's main items from %s have been deleted!") % jid_.userhost())) return d return self._initialise(profile_key).addCallback(initialised) @@ -797,7 +797,7 @@ main_node = self.getNodeName(jid_) d = self.host.plugins["XEP-0060"].getItems(service, main_node, profile_key=profile) d.addCallback(lambda res: getComments(res[0], client)) - d.addErrback(lambda failure, main_node: log.error(_("Retrieval of items for node %(node)s failed: %(message)s") % + d.addErrback(lambda failure, main_node: log.error(_(u"Retrieval of items for node %(node)s failed: %(message)s") % {'node': main_node, 'message': failure.getErrorMessage()}), main_node) blogs.append(d) @@ -820,7 +820,7 @@ service, node = self.host.plugins['XEP-0277'].parseCommentUrl(href) d = self.host.plugins["XEP-0060"].getItems(service, node, profile_key=profile_key) d.addCallback(lambda items: (service, node, items[0])) - d.addErrback(lambda failure, node: log.error(_("Retrieval of comments for node %(node)s failed: %(message)s") % + d.addErrback(lambda failure, node: log.error(_(u"Retrieval of comments for node %(node)s failed: %(message)s") % {'node': node, 'message': failure.getErrorMessage()}), node) comments.append(d) dlist = defer.DeferredList(comments) @@ -852,9 +852,9 @@ deletions = [] if item_ids: # remove the comments of the user on the given post d = self.host.plugins['XEP-0060'].retractItems(service, node_id, item_ids, profile_key=profile_key) - d.addCallback(lambda dummy, node_id: log.debug(_('Comments of user %(user)s in node %(node)s have been retracted') % + d.addCallback(lambda dummy, node_id: log.debug(_(u'Comments of user %(user)s in node %(node)s have been retracted') % {'user': user_jid_s, 'node': node_id}), node_id) - d.addErrback(lambda failure, node_id: log.error(_("Retraction of comments from %(user)s in node %(node)s failed: %(message)s") % + d.addErrback(lambda failure, node_id: log.error(_(u"Retraction of comments from %(user)s in node %(node)s failed: %(message)s") % {'user': user_jid_s, 'node': node_id, 'message': failure.getErrorMessage()}), node_id) deletions.append(d) return defer.DeferredList(deletions)
--- a/src/plugins/plugin_misc_imap.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_misc_imap.py Thu Apr 16 14:57:57 2015 +0200 @@ -108,7 +108,7 @@ should be omitted from the return value, rather than included. @return: A mapping of header field names to header field values """ - log.debug('getHeaders %s - %s' % (negate, names)) + log.debug(u'getHeaders %s - %s' % (negate, names)) final_dict = {} to_check = [name.lower() for name in names] for header in self.message.keys(): @@ -151,7 +151,7 @@ def __init__(self, host, name, profile): self.host = host self.listeners = set() - log.debug('Mailbox init (%s)' % name) + log.debug(u'Mailbox init (%s)' % name) if name != "INBOX": raise imap4.MailboxException("Only INBOX is managed for the moment") self.mailbox = self.host.plugins["Maildir"].accessMessageBox(name, self.newMessage, profile) @@ -180,7 +180,7 @@ @param message: The message sequence number @return: The UID of the message. """ - log.debug('getUID (%i)' % message) + log.debug(u'getUID (%i)' % message) #return self.mailbox.getUid(message-1) #XXX: it seems that this method get uid and not message sequence number return message @@ -236,7 +236,7 @@ @param listener: An object to add to the set of those which will be notified when the contents of this mailbox change. """ - log.debug('addListener %s' % listener) + log.debug(u'addListener %s' % listener) self.listeners.add(listener) def removeListener(self, listener): @@ -281,7 +281,7 @@ about @param uid: If true, the IDs specified in the query are UIDs; """ - log.debug('fetch (%s, %s)' % (messages, uid)) + log.debug(u'fetch (%s, %s)' % (messages, uid)) if uid: messages.last = self.mailbox.getMaxUid() messages.getnext = self.mailbox.getNextExistingUid @@ -436,7 +436,7 @@ log.debug(_("IMAP server connection started")) def clientConnectionLost(self, connector, reason): - log.debug(_("IMAP server connection lost (reason: %s)"), reason) + log.debug(_(u"IMAP server connection lost (reason: %s)"), reason) def buildProtocol(self, addr): log.debug("Building protocol")
--- a/src/plugins/plugin_misc_maildir.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_misc_maildir.py Thu Apr 16 14:57:57 2015 +0200 @@ -128,7 +128,7 @@ @param mailboxUser: MailboxUser instance""" if boxname not in self.__mailboxes: err_msg = _("Trying to remove an mailboxUser not referenced") - log.error(_("INTERNAL ERROR: ") + err_msg) + log.error(_(u"INTERNAL ERROR: ") + err_msg) raise MaildirError(err_msg) assert self.__mailboxes[profile][boxname] == mailboxUser del self.__mailboxes[profile][boxname] @@ -147,7 +147,7 @@ return self.data[profile][boxname] # the boxname MUST exist in the data except KeyError: err_msg = _("Boxname doesn't exist in internal data") - log.error(_("INTERNAL ERROR: ") + err_msg) + log.error(_(u"INTERNAL ERROR: ") + err_msg) raise MaildirError(err_msg) def getUid(self, boxname, message_id, profile): @@ -285,22 +285,22 @@ @param boxname: name of the box which was observed @param signal: which signal was observed by the caller""" if (profile, boxname) not in self.__observed: - err_msg = _("Trying to remove an observer for an inexistant mailbox") - log.error(_("INTERNAL ERROR: ") + err_msg) + err_msg = _(u"Trying to remove an observer for an inexistant mailbox") + log.error(_(u"INTERNAL ERROR: ") + err_msg) raise MaildirError(err_msg) if signal not in self.__observed[(profile, boxname)]: - err_msg = _("Trying to remove an inexistant observer, no observer for this signal") - log.error(_("INTERNAL ERROR: ") + err_msg) + err_msg = _(u"Trying to remove an inexistant observer, no observer for this signal") + log.error(_(u"INTERNAL ERROR: ") + err_msg) raise MaildirError(err_msg) if not callback in self.__observed[(profile, boxname)][signal]: - err_msg = _("Trying to remove an inexistant observer") - log.error(_("INTERNAL ERROR: ") + err_msg) + err_msg = _(u"Trying to remove an inexistant observer") + log.error(_(u"INTERNAL ERROR: ") + err_msg) raise MaildirError(err_msg) self.__observed[(profile, boxname)][signal].remove(callback) def emitSignal(self, profile, boxname, signal_name): """Emit the signal to observer""" - log.debug('emitSignal %s %s %s' % (profile, boxname, signal_name)) + log.debug(u'emitSignal %s %s %s' % (profile, boxname, signal_name)) try: for observer_cb in self.__observed[(profile, boxname)][signal_name]: observer_cb() @@ -336,7 +336,7 @@ @param profile: real profile (ie not a profile_key) THIS OBJECT MUST NOT BE USED DIRECTLY: use MaildirBox.accessMessageBox instead""" if _maildir._checkBoxReference(name, profile): - log.error("INTERNAL ERROR: MailboxUser MUST NOT be instancied directly") + log.error(u"INTERNAL ERROR: MailboxUser MUST NOT be instancied directly") raise MaildirError('double MailboxUser instanciation') if name != "INBOX": raise NotImplementedError @@ -354,7 +354,7 @@ self.__uid_table_update() if observer: - log.debug("adding observer for %s (%s)" % (name, profile)) + log.debug(u"adding observer for %s (%s)" % (name, profile)) self.maildir.addObserver(observer, profile, name, "NEW_MESSAGE") def __uid_table_update(self): @@ -367,7 +367,7 @@ def __del__(self): if self.observer: - log.debug("removing observer for %s" % self.name) + log.debug(u"removing observer for %s" % self.name) self._maildir.removeObserver(self.observer, self.name, "NEW_MESSAGE") self.maildir._removeBoxAccess(self.name, self, profile=self.profile)
--- a/src/plugins/plugin_misc_quiz.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_misc_quiz.py Thu Apr 16 14:57:57 2015 +0200 @@ -181,9 +181,9 @@ """Called when a player give an answer""" profile = self.host.memory.getProfileName(profile_key) if not profile: - log.error(_("profile %s is unknown") % profile_key) + log.error(_(u"profile %s is unknown") % profile_key) return - log.debug('new player answer (%(profile)s): %(answer)s' % {'profile': profile, 'answer': answer}) + log.debug(u'new player answer (%(profile)s): %(answer)s' % {'profile': profile, 'answer': answer}) mess = self.createGameElt(jid.JID(referee)) answer_elt = mess.firstChildElement().addElement('player_answer') answer_elt['player'] = player @@ -281,7 +281,7 @@ status = self.games[room_jid]['status'] nb_players = len(self.games[room_jid]['players']) status[player] = 'ready' - log.debug(_('Player %(player)s is ready to start [status: %(status)s]') % {'player': player, 'status': status}) + log.debug(_(u'Player %(player)s is ready to start [status: %(status)s]') % {'player': player, 'status': status}) if status.values().count('ready') == nb_players: # everybody is ready, we can start the game self.newGame(room_jid, profile) @@ -329,4 +329,4 @@ self.host.bridge.quizGameTimerRestarted(room_jid.userhost(), int(elt['time_left']), profile) else: - log.error(_('Unmanaged game element: %s') % elt.name) + log.error(_(u'Unmanaged game element: %s') % elt.name)
--- a/src/plugins/plugin_misc_radiocol.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_misc_radiocol.py Thu Apr 16 14:57:57 2015 +0200 @@ -136,7 +136,7 @@ # ==> unlink done the Q&D way with the same host trick (see above) radio_data = self.games[room_jid] if len(radio_data['players']) == 0: - log.debug(_('No more participants in the radiocol: cleaning data')) + log.debug(_(u'No more participants in the radiocol: cleaning data')) radio_data['queue'] = [] for filename in radio_data['to_delete']: self.deleteFile(filename, radio_data) @@ -172,14 +172,14 @@ try: file_to_delete = radio_data['to_delete'][filename] except KeyError: - log.error(_("INTERNAL ERROR: can't find full path of the song to delete")) + log.error(_(u"INTERNAL ERROR: can't find full path of the song to delete")) return False else: file_to_delete = filename try: unlink(file_to_delete) except OSError: - log.error(_("INTERNAL ERROR: can't find %s on the file system" % file_to_delete)) + log.error(_(u"INTERNAL ERROR: can't find %s on the file system" % file_to_delete)) return False return True @@ -242,7 +242,7 @@ # songs in queue. We can now start the party :) self.playNext(room_jid, profile) else: - log.error(_('Unmanaged game element: %s') % elt.name) + log.error(_(u'Unmanaged game element: %s') % elt.name) def getSyncDataForPlayer(self, room_jid, nick): game_data = self.games[room_jid]
--- a/src/plugins/plugin_misc_room_game.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_misc_room_game.py Thu Apr 16 14:57:57 2015 +0200 @@ -205,7 +205,7 @@ break if not auth and (verbose or _DEBUG): - log.debug(_("%(user)s not allowed to join the game %(game)s in %(room)s") % {'user': user_jid.userhost() or nick, 'game': self.name, 'room': room_jid.userhost()}) + log.debug(_(u"%(user)s not allowed to join the game %(game)s in %(room)s") % {'user': user_jid.userhost() or nick, 'game': self.name, 'room': room_jid.userhost()}) return auth def _updatePlayers(self, room_jid, nicks, sync, profile): @@ -341,7 +341,7 @@ elif self.invite_mode == self.FROM_PLAYERS: auth = self.isPlayer(room_jid, nick) if not auth and (verbose or _DEBUG): - log.debug(_("%(user)s not allowed to invite for the game %(game)s in %(room)s") % {'user': nick, 'game': self.name, 'room': room_jid.userhost()}) + log.debug(_(u"%(user)s not allowed to invite for the game %(game)s in %(room)s") % {'user': nick, 'game': self.name, 'room': room_jid.userhost()}) return auth def isReferee(self, room_jid, nick): @@ -387,7 +387,7 @@ (nicks, missing) = self.host.plugins["XEP-0045"].getRoomNicksOfUsers(room, other_players, secure=False) result = (len(nicks) == len(other_players), nicks, missing) if not result[0] and (verbose or _DEBUG): - log.debug(_("Still waiting for %(users)s before starting the game %(game)s in %(room)s") % {'users': result[2], 'game': self.name, 'room': room.occupantJID.userhost()}) + log.debug(_(u"Still waiting for %(users)s before starting the game %(game)s in %(room)s") % {'users': result[2], 'game': self.name, 'room': room.occupantJID.userhost()}) return result def getUniqueName(self, muc_service=None, profile_key=C.PROF_KEY_NONE): @@ -413,7 +413,7 @@ @param room_jid (jid.JID): JID of the room, or None to generate a unique name @param profile_key (unicode): %(doc_profile_key)s """ - log.debug(_('Preparing room for %s game') % self.name) + log.debug(_(u'Preparing room for %s game') % self.name) profile = self.host.memory.getProfileName(profile_key) if not profile: log.error(_("Unknown profile")) @@ -456,7 +456,7 @@ # considering the last batch of invitations batch = len(self.invitations[room_jid]) - 1 if batch < 0: - log.error("Invitations from %s to play %s in %s have been lost!" % (profile_nick, self.name, room_jid.userhost())) + log.error(u"Invitations from %s to play %s in %s have been lost!" % (profile_nick, self.name, room_jid.userhost())) return True other_players = self.invitations[room_jid][batch][1] (auth, nicks, dummy) = self._checkWaitAuth(room, other_players) @@ -510,15 +510,15 @@ """ user_nick = self.host.plugins["XEP-0045"].getRoomNick(room_jid, profile) if not user_nick: - log.error('Internal error: profile %s has not joined the room %s' % (profile, room_jid.userhost())) + log.error(u'Internal error: profile %s has not joined the room %s' % (profile, room_jid.userhost())) return False, False if self._gameExists(room_jid): is_referee = self.isReferee(room_jid, user_nick) if self._gameExists(room_jid, started=True): - log.warning(_("%(game)s game already created in room %(room)s") % {'game': self.name, 'room': room_jid.userhost()}) + log.warning(_(u"%(game)s game already created in room %(room)s") % {'game': self.name, 'room': room_jid.userhost()}) return False, is_referee elif not is_referee: - log.warning(_("%(game)s game in room %(room)s can only be created by %(user)s") % {'game': self.name, 'room': room_jid.userhost(), 'user': user_nick}) + log.warning(_(u"%(game)s game in room %(room)s can only be created by %(user)s") % {'game': self.name, 'room': room_jid.userhost(), 'user': user_nick}) return False, False else: self._initGame(room_jid, user_nick) @@ -536,10 +536,10 @@ @param nicks (list[unicode]): list of players nicks in the room (referee included, in first position) @param profile_key (unicode): %(doc_profile_key)s """ - log.debug(_("Creating %(game)s game in room %(room)s") % {'game': self.name, 'room': room_jid}) + log.debug(_(u"Creating %(game)s game in room %(room)s") % {'game': self.name, 'room': room_jid}) profile = self.host.memory.getProfileName(profile_key) if not profile: - log.error(_("profile %s is unknown") % profile_key) + log.error(_(u"profile %s is unknown") % profile_key) return (create, sync) = self._checkCreateGameAndInit(room_jid, profile) if nicks is None: @@ -568,9 +568,9 @@ """ profile = self.host.memory.getProfileName(profile_key) if not profile: - log.error(_("profile %s is unknown") % profile_key) + log.error(_(u"profile %s is unknown") % profile_key) return - log.debug('new player ready: %s' % profile) + log.debug(u'new player ready: %s' % profile) # TODO: we probably need to add the game and room names in the sent message self.send(referee_jid, 'player_ready', {'player': player_nick}, profile=profile) @@ -583,7 +583,7 @@ - msg_elts: dict to map each user to his specific initialization message @param profile """ - log.debug(_('new round for %s game') % self.name) + log.debug(_(u'new round for %s game') % self.name) game_data = self.games[room_jid] players = game_data['players'] players_data = game_data['players_data']
--- a/src/plugins/plugin_misc_smtp.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_misc_smtp.py Thu Apr 16 14:57:57 2015 +0200 @@ -91,7 +91,7 @@ subject=mail['subject'].decode('utf-8', 'replace'), mess_type='normal', profile_key=self.profile) except: exc_type, exc_value, exc_traceback = sys.exc_info() - log.error(_("Can't send message: %s") % exc_value) # The email is invalid or incorreclty parsed + log.error(_(u"Can't send message: %s") % exc_value) # The email is invalid or incorreclty parsed return defer.fail() self.message = None return defer.succeed(None) @@ -200,7 +200,7 @@ smtp.SMTPFactory.startedConnecting(self, connector) def clientConnectionLost(self, connector, reason): - log.debug(_("SMTP server connection lost (reason: %s)"), reason) + log.debug(_(u"SMTP server connection lost (reason: %s)"), reason) smtp.SMTPFactory.clientConnectionLost(self, connector, reason) def buildProtocol(self, addr):
--- a/src/plugins/plugin_misc_tarot.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_misc_tarot.py Thu Apr 16 14:57:57 2015 +0200 @@ -198,7 +198,7 @@ pl_waiting = players_data[player]['wait_for_low'] played.remove(card) players_data[pl_waiting]['levees'].append(card) - log.debug(_('Player %(excuse_owner)s give %(card_waited)s to %(player_waiting)s for Excuse compensation') % {"excuse_owner": player, "card_waited": card, "player_waiting": pl_waiting}) + log.debug(_(u'Player %(excuse_owner)s give %(card_waited)s to %(player_waiting)s for Excuse compensation') % {"excuse_owner": player, "card_waited": card, "player_waiting": pl_waiting}) return return @@ -229,12 +229,12 @@ low_card = owner_levees[card_idx] del owner_levees[card_idx] players_data[winner]['levees'].append(low_card) - log.debug(_('Player %(excuse_owner)s give %(card_waited)s to %(player_waiting)s for Excuse compensation') % {"excuse_owner": excuse_player, "card_waited": low_card, "player_waiting": winner}) + log.debug(_(u'Player %(excuse_owner)s give %(card_waited)s to %(player_waiting)s for Excuse compensation') % {"excuse_owner": excuse_player, "card_waited": low_card, "player_waiting": winner}) break if not low_card: # The player has no low card yet # TODO: manage case when player never win a trick with low card players_data[excuse_player]['wait_for_low'] = winner - log.debug(_("%(excuse_owner)s keep the Excuse but has not card to give, %(winner)s is waiting for one") % {'excuse_owner': excuse_player, 'winner': winner}) + log.debug(_(u"%(excuse_owner)s keep the Excuse but has not card to give, %(winner)s is waiting for one") % {'excuse_owner': excuse_player, 'winner': winner}) def __draw_game(self, game_data): """The game is draw, no score change @@ -244,7 +244,7 @@ scores_str = _('Draw game') scores_str += '\n' for player in game_data['players']: - scores_str += _("\n--\n%(player)s:\nscore for this game ==> %(score_game)i\ntotal score ==> %(total_score)i") % {'player': player, 'score_game': 0, 'total_score': players_data[player]['score']} + scores_str += _(u"\n--\n%(player)s:\nscore for this game ==> %(score_game)i\ntotal score ==> %(total_score)i") % {'player': player, 'score_game': 0, 'total_score': players_data[player]['score']} log.debug(scores_str) return (scores_str, [], []) @@ -313,10 +313,10 @@ else: loosers.append(player) - scores_str = _('The attacker (%(attaquant)s) makes %(points)i and needs to make %(point_limit)i (%(nb_bouts)s oulder%(plural)s%(separator)s%(bouts)s): (s)he %(victory)s') % {'attaquant': game_data['attaquant'], 'points': score, 'point_limit': point_limit, 'nb_bouts': nb_bouts, 'plural': 's' if nb_bouts > 1 else '', 'separator': ': ' if nb_bouts != 0 else '', 'bouts': ','.join(map(str, bouts)), 'victory': 'wins' if victory else 'looses'} + scores_str = _(u'The attacker (%(attaquant)s) makes %(points)i and needs to make %(point_limit)i (%(nb_bouts)s oulder%(plural)s%(separator)s%(bouts)s): (s)he %(victory)s') % {'attaquant': game_data['attaquant'], 'points': score, 'point_limit': point_limit, 'nb_bouts': nb_bouts, 'plural': 's' if nb_bouts > 1 else '', 'separator': ': ' if nb_bouts != 0 else '', 'bouts': ','.join(map(str, bouts)), 'victory': 'wins' if victory else 'looses'} scores_str += '\n' for player in game_data['players']: - scores_str += _("\n--\n%(player)s:\nscore for this game ==> %(score_game)i\ntotal score ==> %(total_score)i") % {'player': player, 'score_game': player_score[player], 'total_score': players_data[player]['score']} + scores_str += _(u"\n--\n%(player)s:\nscore for this game ==> %(score_game)i\ntotal score ==> %(total_score)i") % {'player': player, 'score_game': player_score[player], 'total_score': players_data[player]['score']} log.debug(scores_str) return (scores_str, winners, loosers) @@ -402,7 +402,7 @@ player = self.host.plugins["XEP-0045"].getRoomNick(room_jid, profile) data = xml_tools.XMLUIResult2DataFormResult(raw_data) contrat = data['contrat'] - log.debug(_('contrat [%(contrat)s] choosed by %(profile)s') % {'contrat': contrat, 'profile': profile}) + log.debug(_(u'contrat [%(contrat)s] choosed by %(profile)s') % {'contrat': contrat, 'profile': profile}) d = self.send(referee_jid, ('', 'contrat_choosed'), {'player': player}, content=contrat, profile=profile) d.addCallback(lambda ignore: {}) del self._sessions[raw_data["session_id"]] @@ -435,9 +435,9 @@ """ profile = self.host.memory.getProfileName(profile_key) if not profile: - log.error(_("profile %s is unknown") % profile_key) + log.error(_(u"profile %s is unknown") % profile_key) return - log.debug(_('Cards played by %(profile)s: [%(cards)s]') % {'profile': profile, 'cards': cards}) + log.debug(_(u'Cards played by %(profile)s: [%(cards)s]') % {'profile': profile, 'cards': cards}) elem = self.__card_list_to_xml(TarotCard.from_tuples(cards), 'cards_played') self.send(jid.JID(referee), elem, {'player': player}, profile=profile) @@ -503,7 +503,7 @@ status = self.games[room_jid]['status'] nb_players = len(self.games[room_jid]['players']) status[player] = 'ready' - log.debug(_('Player %(player)s is ready to start [status: %(status)s]') % {'player': player, 'status': status}) + log.debug(_(u'Player %(player)s is ready to start [status: %(status)s]') % {'player': player, 'status': status}) if status.values().count('ready') == nb_players: # everybody is ready, we can start the game self.newRound(room_jid, profile) @@ -545,7 +545,7 @@ for player in game_data['players']: game_data['status'][player] = "init" return - log.debug(_("%(player)s win the bid with %(contrat)s") % {'player': best_contrat[0], 'contrat': best_contrat[1]}) + log.debug(_(u"%(player)s win the bid with %(contrat)s") % {'player': best_contrat[0], 'contrat': best_contrat[1]}) game_data['contrat'] = best_contrat[1] if game_data['contrat'] == "Garde Sans" or game_data['contrat'] == "Garde Contre": @@ -617,7 +617,7 @@ if all(played): # everybody has played winner = self.__winner(game_data) - log.debug(_('The winner of this trick is %s') % winner) + log.debug(_(u'The winner of this trick is %s') % winner) # the winner win the trick self.__excuse_hack(game_data, played, winner) players_data[elt['player']]['levees'].extend(played) @@ -663,9 +663,9 @@ invalid_cards = self.__xml_to_list(elt.elements(name='invalid', uri=NS_CG).next()) self.host.bridge.tarotGameInvalidCards(room_jid.userhost(), elt['phase'], played_cards, invalid_cards, profile) else: - log.error(_('Unmanaged error type: %s') % elt['type']) + log.error(_(u'Unmanaged error type: %s') % elt['type']) else: - log.error(_('Unmanaged card game element: %s') % elt.name) + log.error(_(u'Unmanaged card game element: %s') % elt.name) def getSyncDataForPlayer(self, room_jid, nick): return []
--- a/src/plugins/plugin_misc_text_commands.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_misc_text_commands.py Thu Apr 16 14:57:57 2015 +0200 @@ -138,7 +138,7 @@ if attr.startswith('cmd_'): cmd = getattr(instance, attr) if not callable(cmd): - log.warning(_("Skipping not callable [%s] attribute") % attr) + log.warning(_(u"Skipping not callable [%s] attribute") % attr) continue cmd_name = attr[4:] if not cmd_name: @@ -148,7 +148,7 @@ while (cmd_name + str(suff)) in self._commands: suff+=1 new_name = cmd_name + str(suff) - log.warning(_("Conflict for command [%(old_name)s], renaming it to [%(new_name)s]") % {'old_name': cmd_name, 'new_name': new_name}) + log.warning(_(u"Conflict for command [%(old_name)s], renaming it to [%(new_name)s]") % {'old_name': cmd_name, 'new_name': new_name}) cmd_name = new_name self._commands[cmd_name] = cmd_data = OrderedDict({'callback':cmd}) # We use an Ordered dict to keep documenation order cmd_data.update(self._parseDocString(cmd, cmd_name))
--- a/src/plugins/plugin_sec_otr.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_sec_otr.py Thu Apr 16 14:57:57 2015 +0200 @@ -155,12 +155,12 @@ trust_data = self.client.otr_data.get('trust', {}) for jid_, jid_data in trust_data.iteritems(): for fingerprint, trust_level in jid_data.iteritems(): - log.debug('setting trust for {jid}: [{fingerprint}] = "{trust_level}"'.format(jid=jid_, fingerprint=fingerprint, trust_level=trust_level)) + log.debug(u'setting trust for {jid}: [{fingerprint}] = "{trust_level}"'.format(jid=jid_, fingerprint=fingerprint, trust_level=trust_level)) self.trusts.setdefault(jid.JID(jid_), {})[fingerprint] = trust_level def saveTrusts(self): - log.debug("saving trusts for {profile}".format(profile=self.client.profile)) - log.debug("trusts = {}".format(self.client.otr_data['trust'])) + log.debug(u"saving trusts for {profile}".format(profile=self.client.profile)) + log.debug(u"trusts = {}".format(self.client.otr_data['trust'])) self.client.otr_data.force('trust') def setTrust(self, other_jid, fingerprint, trustLevel): @@ -189,7 +189,7 @@ def getContextForUser(self, other): log.debug(u"getContextForUser [%s]" % other) if not other.resource: - log.warning("getContextForUser called with a bare jid: %s" % other.full()) + log.warning(u"getContextForUser called with a bare jid: %s" % other.full()) return self.startContext(other)
--- a/src/plugins/plugin_xep_0020.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0020.py Thu Apr 16 14:57:57 2015 +0200 @@ -69,7 +69,7 @@ values = form.fields[field].values result[field] = values[0] if values else None if len(values) > 1: - log.warning(_("More than one value choosed for %s, keeping the first one") % field) + log.warning(_(u"More than one value choosed for %s, keeping the first one") % field) return result def negociate(self, feature_elt, form_type, negociable_values):
--- a/src/plugins/plugin_xep_0033.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0033.py Thu Apr 16 14:57:57 2015 +0200 @@ -88,8 +88,8 @@ raise failure.Failure(exceptions.CancelError()) if mess_data["to"] not in entities: expected = _(' or ').join([entity.userhost() for entity in entities]) - log.warning(_("Stanzas using XEP-0033 should be addressed to %(expected)s, not %(current)s!") % {'expected': expected, 'current': mess_data["to"]}) - log.warning(_("TODO: addressing has been fixed by the backend... fix it in the frontend!")) + log.warning(_(u"Stanzas using XEP-0033 should be addressed to %(expected)s, not %(current)s!") % {'expected': expected, 'current': mess_data["to"]}) + log.warning(_(u"TODO: addressing has been fixed by the backend... fix it in the frontend!")) mess_data["to"] = list(entities)[0].userhostJID() element = mess_data['xml'].addElement('addresses', NS_ADDRESS) entries = [entry.split(':') for entry in mess_data['extra']['address'].split('\n') if entry != '']
--- a/src/plugins/plugin_xep_0045.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0045.py Thu Apr 16 14:57:57 2015 +0200 @@ -106,7 +106,7 @@ @param profile: profile to check @return: True if the profile is connected and has used the MUC feature, else False""" if not profile or profile not in self.clients or not self.host.isConnected(profile): - log.error(_('Unknown or disconnected profile (%s)') % profile) + log.error(_(u'Unknown or disconnected profile (%s)') % profile) if profile in self.clients: del self.clients[profile] return False @@ -138,7 +138,7 @@ # and send the signal only when the room is unlocked # a proper configuration management should be done print "room locked !" - self.clients[profile].configure(room.roomJID, {}).addCallbacks(_sendBridgeSignal, lambda x: log.error(_('Error while configuring the room'))) + self.clients[profile].configure(room.roomJID, {}).addCallbacks(_sendBridgeSignal, lambda x: log.error(_(u'Error while configuring the room'))) else: _sendBridgeSignal() return room @@ -359,9 +359,9 @@ if not self.checkClient(profile): return _errDeferred() if room_jid in self.clients[profile].joined_rooms: - log.warning(_('%(profile)s is already in room %(room_jid)s') % {'profile': profile, 'room_jid': room_jid.userhost()}) + log.warning(_(u'%(profile)s is already in room %(room_jid)s') % {'profile': profile, 'room_jid': room_jid.userhost()}) return _errDeferred() - log.info(_("[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile': profile, 'room': room_jid.userhost(), 'nick': nick}) + log.info(_(u"[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile': profile, 'room': room_jid.userhost(), 'nick': nick}) if "history" in options: history_limit = int(options["history"]) @@ -709,7 +709,7 @@ if user.nick in self.__changing_nicks: self.__changing_nicks.remove(user.nick) else: - log.debug(_("user %(nick)s has joined room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()}) + log.debug(_(u"user %(nick)s has joined room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()}) if not self.host.trigger.point("MUC user joined", room, user, self.parent.profile): return user_data = {'entity': user.entity.full() if user.entity else '', 'affiliation': user.affiliation, 'role': user.role} @@ -721,12 +721,12 @@ if user.nick == room.nick: # we left the room room_jid_s = room.roomJID.userhost() - log.info(_("Room [%(room)s] left (%(profile)s))") % {"room": room_jid_s, + log.info(_(u"Room [%(room)s] left (%(profile)s))") % {"room": room_jid_s, "profile": self.parent.profile}) self.host.memory.delEntityCache(room.roomJID, profile_key=self.parent.profile) self.host.bridge.roomLeft(room.roomJID.userhost(), self.parent.profile) else: - log.debug(_("user %(nick)s left room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()}) + log.debug(_(u"user %(nick)s left room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()}) user_data = {'entity': user.entity.full() if user.entity else '', 'affiliation': user.affiliation, 'role': user.role} self.host.bridge.roomUserLeft(room.roomJID.userhost(), user.nick, user_data, self.parent.profile) @@ -737,15 +737,15 @@ self.host.bridge.presenceUpdate(room.roomJID.userhost() + '/' + user.nick, show or '', 0, {'default': status or ''}, self.parent.profile) def receivedGroupChat(self, room, user, body): - log.debug('receivedGroupChat: room=%s user=%s body=%s' % (room.roomJID.full(), user, body)) + log.debug(u'receivedGroupChat: room=%s user=%s body=%s' % (room.roomJID.full(), user, body)) def receivedHistory(self, room, user, message): # http://xmpp.org/extensions/xep-0045.html#enter-history - # log.debug('receivedHistory: room=%s user=%s body=%s' % (room.roomJID.full(), user, message)) + # log.debug(u'receivedHistory: room=%s user=%s body=%s' % (room.roomJID.full(), user, message)) pass def receivedSubject(self, room, user, subject): # http://xmpp.org/extensions/xep-0045.html#enter-subject - log.debug(_("New subject for room (%(room_id)s): %(subject)s") % {'room_id': room.roomJID.full(), 'subject': subject}) + log.debug(_(u"New subject for room (%(room_id)s): %(subject)s") % {'room_id': room.roomJID.full(), 'subject': subject}) self.rec_subjects[room.roomJID.userhost()] = (room.roomJID.userhost(), subject) self.host.bridge.roomNewSubject(room.roomJID.userhost(), subject, self.parent.profile)
--- a/src/plugins/plugin_xep_0047.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0047.py Thu Apr 16 14:57:57 2015 +0200 @@ -143,11 +143,11 @@ sid = open_elt.getAttribute('sid') stanza = open_elt.getAttribute('stanza', 'iq') if not sid or not block_size or int(block_size) > 65535: - log.warning(_("malformed IBB transfer: %s" % IQ['id'])) + log.warning(_(u"malformed IBB transfer: %s" % IQ['id'])) self.sendNotAcceptableError(IQ['id'], IQ['from'], client.xmlstream) return if not sid in client.xep_0047_current_stream: - log.warning(_("Ignoring unexpected IBB transfer: %s" % sid)) + log.warning(_(u"Ignoring unexpected IBB transfer: %s" % sid)) self.sendNotAcceptableError(IQ['id'], IQ['from'], client.xmlstream) return if client.xep_0047_current_stream[sid]["from"] != jid.JID(IQ['from']):
--- a/src/plugins/plugin_xep_0048.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0048.py Thu Apr 16 14:57:57 2015 +0200 @@ -221,7 +221,7 @@ d = self.host.plugins['XEP-0045'].join(room_jid, nick, {}, profile_key=profile) def join_eb(failure): - log.warning("Error while trying to join room: %s" % failure) + log.warning(u"Error while trying to join room: %s" % failure) # FIXME: failure are badly managed in plugin XEP-0045. Plugin XEP-0045 need to be fixed before managing errors correctly here return {} d.addCallbacks(lambda dummy: {}, join_eb)
--- a/src/plugins/plugin_xep_0050.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0050.py Thu Apr 16 14:57:57 2015 +0200 @@ -107,7 +107,7 @@ try: allowed.update(self.client.roster.getJidsFromGroup(group)) except exceptions.UnknownGroupError: - log.warning(_("The groups [%(group)s] is unknown for profile [%(profile)s])" % {'group':group, 'profile':self.client.profile})) + log.warning(_(u"The groups [%(group)s] is unknown for profile [%(profile)s])" % {'group':group, 'profile':self.client.profile})) if requestor.userhostJID() in allowed: return True return False @@ -254,7 +254,7 @@ return C.XMLUI_DATA_LVL_WARNING else: if type_ != 'info': - log.warning(_("Invalid note type [%s], using info") % type_) + log.warning(_(u"Invalid note type [%s], using info") % type_) return C.XMLUI_DATA_LVL_INFO def _mergeNotes(self, notes):
--- a/src/plugins/plugin_xep_0054.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0054.py Thu Apr 16 14:57:57 2015 +0200 @@ -171,15 +171,15 @@ if not os.path.exists(filename): with open(filename, 'wb') as file_: file_.write(data) - log.debug(_("file saved to %s") % hash_) + log.debug(_(u"file saved to %s") % hash_) else: - log.debug(_("file [%s] already in cache") % hash_) + log.debug(_(u"file [%s] already in cache") % hash_) def savePhoto(self, photo_xml): """Parse a <PHOTO> elem and save the picture""" for elem in photo_xml.elements(): if elem.name == 'TYPE': - log.debug(_('Photo of type [%s] found') % str(elem)) + log.debug(_(u'Photo of type [%s] found') % str(elem)) if elem.name == 'BINVAL': log.debug(_('Decoding binary')) decoded = b64decode(str(elem)) @@ -242,11 +242,11 @@ def _VCardEb(self, failure, profile): """Called when something is wrong with registration""" try: - log.warning(_("Can't find VCard of %s") % failure.value.stanza['from']) + log.warning(_(u"Can't find VCard of %s") % failure.value.stanza['from']) self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile) # FIXME: maybe an error message would be better self.updateCache(jid.JID(failure.value.stanza['from']), "avatar", '', profile) except AttributeError: # 'ConnectionLost' object has no attribute 'stanza' - log.warning(_("Can't find VCard: %s") % failure.getErrorMessage()) + log.warning(_(u"Can't find VCard: %s") % failure.getErrorMessage()) def _getCard(self, target_s, profile_key=C.PROF_KEY_NONE): return self.getCard(jid.JID(target_s), profile_key) @@ -262,7 +262,7 @@ raise exceptions.ProfileUnknownError('Asking vcard for a non-existant or not connected profile ({})'.format(profile_key)) profile = self.host.memory.getProfileName(profile_key) to_jid = target.userhostJID() - log.debug(_("Asking for %s's VCard") % to_jid.userhost()) + log.debug(_(u"Asking for %s's VCard") % to_jid.userhost()) reg_request = IQ(xmlstream, 'get') reg_request["from"] = current_jid.full() reg_request["to"] = to_jid.userhost() @@ -277,7 +277,7 @@ """ filename = self.avatar_path + '/' + avatar_hash if not os.path.exists(filename): - log.error(_("Asking for an uncached avatar [%s]") % avatar_hash) + log.error(_(u"Asking for an uncached avatar [%s]") % avatar_hash) return "" return filename
--- a/src/plugins/plugin_xep_0055.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0055.py Thu Apr 16 14:57:57 2015 +0200 @@ -121,7 +121,7 @@ def _fieldsErr(self, failure, profile): """ Called when something is wrong with fields request """ - log.info(_("Fields request failure: %s") % str(failure.value)) + log.info(_("Fields request failure: %s") % unicode(failure.value)) return failure def _xmluiSearchRequest(self, raw_data, profile): @@ -179,5 +179,5 @@ def _searchErr(self, failure, profile): """ Called when something is wrong with search request """ - log.info(_("Search request failure: %s") % str(failure.value)) + log.info(_("Search request failure: %s") % unicode(failure.value)) return failure
--- a/src/plugins/plugin_xep_0065.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0065.py Thu Apr 16 14:57:57 2015 +0200 @@ -305,7 +305,7 @@ return None def connectionMade(self): - log.debug("connectionMade (mode = %s)" % "requester" if isinstance(self.factory, Socks5ServerFactory) else "target") + log.debug(u"connectionMade (mode = %s)" % "requester" if isinstance(self.factory, Socks5ServerFactory) else "target") if isinstance(self.factory, Socks5ClientFactory): self.sid = self.factory.sid @@ -352,7 +352,8 @@ pass def authenticateUserPass(self, user, passwd): - log.debug("User/pass: %s/%s" % (user, passwd)) + # FIXME: implement authentication and remove the debug printing a password + log.debug(u"User/pass: %s/%s" % (user, passwd)) return True def dataReceived(self, buf): @@ -403,7 +404,7 @@ log.debug(_("Socks 5 server connection started")) def clientConnectionLost(self, connector, reason): - log.debug(_("Socks 5 server connection lost (reason: %s)") % reason) + log.debug(_(u"Socks 5 server connection lost (reason: %s)") % reason) class Socks5ClientFactory(protocol.ClientFactory): @@ -431,7 +432,7 @@ log.debug(_("Socks 5 client connection started")) def clientConnectionLost(self, connector, reason): - log.debug(_("Socks 5 client connection lost (reason: %s)") % reason) + log.debug(_(u"Socks 5 client connection lost (reason: %s)") % reason) self.finishedCb(self.sid, reason.type == error.ConnectionDone, self.profile) # TODO: really check if the state is actually successful @@ -684,7 +685,7 @@ streamhost_elts = filter(lambda elt: elt.name == 'streamhost', query_elt.elements()) if not sid in client.xep_0065_current_stream: - log.warning(_("Ignoring unexpected BS transfer: %s" % sid)) + log.warning(_(u"Ignoring unexpected BS transfer: %s" % sid)) self.sendNotAcceptableError(iq_elt['id'], iq_elt['from'], xmlstream) return @@ -693,7 +694,7 @@ client.xep_0065_current_stream[sid]["xmlstream"] = xmlstream if not streamhost_elts: - log.warning(_("No streamhost found in stream query %s" % sid)) + log.warning(_(u"No streamhost found in stream query %s" % sid)) self.sendBadRequestError(iq_elt['id'], iq_elt['from'], xmlstream) return
--- a/src/plugins/plugin_xep_0077.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0077.py Thu Apr 16 14:57:57 2015 +0200 @@ -84,17 +84,17 @@ def _regErr(self, failure, client): """Called when something is wrong with registration""" - log.info(_("Registration failure: %s") % str(failure.value)) + log.info(_("Registration failure: %s") % unicode(failure.value)) raise failure def _regSuccess(self, answer, client, post_treat_cb): - log.debug(_("registration answer: %s") % answer.toXml()) + log.debug(_(u"registration answer: %s") % answer.toXml()) if post_treat_cb is not None: post_treat_cb(jid.JID(answer['from']), client.profile) return {} def _regFailure(self, failure, client): - log.info(_("Registration failure: %s") % str(failure.value)) + log.info(_(u"Registration failure: %s") % unicode(failure.value)) if failure.value.condition == 'conflict': raise exceptions.ConflictError( _("Username already exists, please choose an other one")) raise failure @@ -105,7 +105,7 @@ def inBandRegister(self, to_jid, post_treat_cb=None, profile_key=C.PROF_KEY_NONE): """register to a target JID""" client = self.host.getClient(profile_key) - log.debug(_("Asking registration for [%s]") % to_jid.full()) + log.debug(_(u"Asking registration for [%s]") % to_jid.full()) reg_request = IQ(client.xmlstream, 'get') reg_request["from"] = client.jid.full() reg_request["to"] = to_jid.full()
--- a/src/plugins/plugin_xep_0095.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0095.py Thu Apr 16 14:57:57 2015 +0200 @@ -182,7 +182,7 @@ offer = client.IQ(xmlstream, 'set') sid = str(uuid.uuid4()) - log.debug(_("Stream Session ID: %s") % offer["id"]) + log.debug(_(u"Stream Session ID: %s") % offer["id"]) offer["from"] = current_jid.full() offer["to"] = to_jid.full()
--- 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})
--- a/src/plugins/plugin_xep_0100.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0100.py Thu Apr 16 14:57:57 2015 +0200 @@ -125,7 +125,7 @@ """ category, type_ = identity if category != 'gateway': - log.error(_('INTERNAL ERROR: identity category should always be "gateway" in _getTypeString, got "%s"') % category) + log.error(_(u'INTERNAL ERROR: identity category should always be "gateway" in _getTypeString, got "%s"') % category) try: return _(TYPE_DESCRIPTIONS[type_]) except KeyError: @@ -167,10 +167,10 @@ entity = items[idx].entity gateways = [(identity, result.identities[identity]) for identity in result.identities if identity[0] == 'gateway'] if gateways: - log.info(_("Found gateway [%(jid)s]: %(identity_name)s") % {'jid': entity.full(), 'identity_name': ' - '.join([gateway[1] for gateway in gateways])}) + log.info(_(u"Found gateway [%(jid)s]: %(identity_name)s") % {'jid': entity.full(), 'identity_name': ' - '.join([gateway[1] for gateway in gateways])}) ret.append((success, (entity, gateways))) else: - log.info(_("Skipping [%(jid)s] which is not a gateway") % {'jid': entity.full()}) + log.info(_(u"Skipping [%(jid)s] which is not a gateway") % {'jid': entity.full()}) return ret def _itemsReceived(self, disco, target, client): @@ -182,7 +182,7 @@ _defers = [] for item in disco._items: - log.debug(_("item found: %s") % item.entity) + log.debug(_(u"item found: %s") % item.entity) _defers.append(client.disco.requestInfo(item.entity)) dl = defer.DeferredList(_defers) dl.addCallback(self._infosReceived, items=disco._items, target=target, client=client) @@ -203,7 +203,7 @@ """Find gateways in the target JID, using discovery protocol """ client = self.host.getClient(profile) - log.debug(_("find gateways (target = %(target)s, profile = %(profile)s)") % {'target': target.full(), 'profile': profile}) + log.debug(_(u"find gateways (target = %(target)s, profile = %(profile)s)") % {'target': target.full(), 'profile': profile}) d = client.disco.requestItems(target) d.addCallback(self._itemsReceived, target=target, client=client) return d
--- a/src/plugins/plugin_xep_0115.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0115.py Thu Apr 16 14:57:57 2015 +0200 @@ -140,28 +140,28 @@ c_hash = c_elem['hash'] c_node = c_elem['node'] except KeyError: - log.warning(_('Received invalid capabilities tag: %s') % c_elem.toXml()) + log.warning(_(u'Received invalid capabilities tag: %s') % c_elem.toXml()) return if c_ver in self.host.memory.disco.hashes: # we already know the hash, we update the jid entity - log.debug ("hash [%(hash)s] already in cache, updating entity [%(jid)s]" % {'hash': c_ver, 'jid': from_jid.full()}) + log.debug(u"hash [%(hash)s] already in cache, updating entity [%(jid)s]" % {'hash': c_ver, 'jid': from_jid.full()}) self.host.memory.updateEntityData(from_jid, C.ENTITY_CAP_HASH, c_ver, profile_key=self.profile) return if c_hash != 'sha-1': # unknown hash method - log.warning(_('Unknown hash method for entity capabilities: [%(hash_method)s] (entity: %(jid)s, node: %(node)s)') % {'hash_method':c_hash, 'jid': from_jid, 'node': c_node}) + log.warning(_(u'Unknown hash method for entity capabilities: [%(hash_method)s] (entity: %(jid)s, node: %(node)s)') % {'hash_method':c_hash, 'jid': from_jid, 'node': c_node}) def cb(dummy): computed_hash = self.host.memory.getEntityDatum(from_jid, C.ENTITY_CAP_HASH, self.profile) if computed_hash != c_ver: - log.warning(_('Computed hash differ from given hash:\ngiven: [%(given_hash)s]\ncomputed: [%(computed_hash)s]\n(entity: %(jid)s, node: %(node)s)') % {'given_hash':c_ver, 'computed_hash': computed_hash, 'jid': from_jid, 'node': c_node}) + log.warning(_(u'Computed hash differ from given hash:\ngiven: [%(given_hash)s]\ncomputed: [%(computed_hash)s]\n(entity: %(jid)s, node: %(node)s)') % {'given_hash':c_ver, 'computed_hash': computed_hash, 'jid': from_jid, 'node': c_node}) def eb(failure): if isinstance(failure.value, error.ConnectionDone): return msg = failure.value.condition if hasattr(failure.value, 'condition') else failure.getErrorMessage() - log.error(_("Couldn't retrieve disco info for {jid}: {error}").format(jid=from_jid.full(), error=msg)) + log.error(_(u"Couldn't retrieve disco info for {jid}: {error}").format(jid=from_jid.full(), error=msg)) d = self.host.getDiscoInfos(from_jid, self.profile) d.addCallbacks(cb, eb)
--- a/src/plugins/plugin_xep_0163.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0163.py Thu Apr 16 14:57:57 2015 +0200 @@ -92,7 +92,7 @@ """ profile = self.host.memory.getProfileName(profile_key) if not profile: - log.error(_('Trying to send personal event with an unknown profile key [%s]') % profile_key) + log.error(_(u'Trying to send personal event with an unknown profile key [%s]') % profile_key) raise exceptions.ProfileUnknownError if not event_type in self.pep_out_cb.keys(): log.error(_('Trying to send personal event for an unknown type'))
--- a/src/plugins/plugin_xep_0249.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0249.py Thu Apr 16 14:57:57 2015 +0200 @@ -129,7 +129,7 @@ if not profile: log.error(_("Profile doesn't exists !")) return - log.info(_('Invitation accepted for room %(room)s [%(profile)s]') % {'room': room_jid.userhost(), 'profile': profile}) + log.info(_(u'Invitation accepted for room %(room)s [%(profile)s]') % {'room': room_jid.userhost(), 'profile': profile}) _jid, xmlstream = self.host.getJidNStream(profile) d = self.host.plugins["XEP-0045"].join(room_jid, _jid.user, {}, profile) return d @@ -142,7 +142,7 @@ """ try: room_jid_s = message.firstChildElement()['jid'] - log.info(_('Invitation received for room %(room)s [%(profile)s]') % {'room': room_jid_s, 'profile': profile}) + log.info(_(u'Invitation received for room %(room)s [%(profile)s]') % {'room': room_jid_s, 'profile': profile}) except: log.error(_('Error while parsing invitation')) return
--- a/src/plugins/plugin_xep_0277.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0277.py Thu Apr 16 14:57:57 2015 +0200 @@ -129,13 +129,13 @@ # or defer.returnValue(Exception), it will explode and then the normal callback is ran. if item.uri not in (NS_PUBSUB, NS_PUBSUB + "#event"): - log.error(_("Unsupported namespace {ns} in pubsub item {id}").format(ns=item.uri, id=item_id)) + log.error(_(u"Unsupported namespace {ns} in pubsub item {id}").format(ns=item.uri, id=item_id)) defer.returnValue(exceptions.DataError()) try: entry_elt = xpath(item_elt, 'entry')[0] except IndexError: - log.error(_('No atom entry found in the pubsub item %s') % item_id) + log.error(_(u'No atom entry found in the pubsub item %s') % item_id) defer.returnValue(exceptions.DataError()) microblog_data = {} @@ -159,7 +159,7 @@ microblog_data['updated'] = date2float(entry_elt, 'updated') assert('title' in microblog_data) # has been processed already except IndexError: - log.error(_("Atom entry of pubsub item %s misses a required element") % item_id) + log.error(_(u"Atom entry of pubsub item %s misses a required element") % item_id) defer.returnValue(exceptions.DataError()) if 'content' not in microblog_data: # use the atom title data as the microblog body content @@ -185,7 +185,7 @@ microblog_data['comments_service'] = service.full() microblog_data['comments_node'] = node except (exceptions.DataError, RuntimeError, KeyError): - log.warning(_("Can't parse the link element of atom entry %s") % microblog_data['id']) + log.warning(_(u"Can't parse the link element of atom entry %s") % microblog_data['id']) except: pass try: @@ -194,7 +194,7 @@ try: # XXX: workaround for Jappix behaviour microblog_data['author'] = xpath(entry_elt, 'author/nick')[0].text except IndexError: - log.warning(_("Can't find author element in atom entry %s") % microblog_data['id']) + log.warning(_(u"Can't find author element in atom entry %s") % microblog_data['id']) defer.returnValue(microblog_data) @@ -339,7 +339,7 @@ def cb(result): #Node is created with right permission - log.debug(_("Microblog node has now access %s") % access) + log.debug(_(u"Microblog node has now access %s") % access) def fatal_err(s_error): #Something went wrong
--- a/src/plugins/plugin_xep_0313.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/plugins/plugin_xep_0313.py Thu Apr 16 14:57:57 2015 +0200 @@ -119,7 +119,7 @@ if form_xml: form = data_form.Form.fromElement(parseXml(form_xml)) if form.formNamespace != NS_MAM: - log.error(_("Expected a MAM Data Form, got instead: %s") % form.formNamespace) + log.error(_(u"Expected a MAM Data Form, got instead: %s") % form.formNamespace) form = None else: form = None
--- a/src/tools/config.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/tools/config.py Thu Apr 16 14:57:57 2015 +0200 @@ -46,7 +46,7 @@ for file_ in C.CONFIG_FILES[::-1]: # we will eventually update the existing file with the highest priority, if it's a user personal file... if not silent: - log.debug(_("Testing file %s") % file_) + log.debug(_(u"Testing file %s") % file_) if os.path.isfile(file_): if file_.startswith(os.path.expanduser('~')): config.read([file_]) @@ -63,7 +63,7 @@ if not silent: if option in ('passphrase',): # list here the options storing a password value = '******' - log.warning(_("Config auto-update: %(option)s set to %(value)s in the file %(config_file)s") % + log.warning(_(u"Config auto-update: %(option)s set to %(value)s in the file %(config_file)s") % {'option': option, 'value': value, 'config_file': target_file})
--- a/src/tools/trigger.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/tools/trigger.py Thu Apr 16 14:57:57 2015 +0200 @@ -60,9 +60,9 @@ self.__triggers[point_name] = [] if priority != 0 and priority in [trigger_tuple[0] for trigger_tuple in self.__triggers[point_name]]: if priority in (self.MIN_PRIORITY, self.MAX_PRIORITY): - log.warning(_("There is already a bound priority [%s]") % point_name) + log.warning(_(u"There is already a bound priority [%s]") % point_name) else: - log.debug(_("There is already a trigger with the same priority [%s]") % point_name) + log.debug(_(u"There is already a trigger with the same priority [%s]") % point_name) self.__triggers[point_name].append((priority, callback)) self.__triggers[point_name].sort(key=lambda trigger_tuple: trigger_tuple[0], reverse=True)
--- a/src/tools/xml_tools.py Thu Apr 16 13:31:14 2015 +0200 +++ b/src/tools/xml_tools.py Thu Apr 16 14:57:57 2015 +0200 @@ -153,7 +153,7 @@ for item_elt in item_elts: for elt in item_elt.elements(): if elt.name != 'field': - log.warning("Unexpected tag (%s)" % elt.name) + log.warning(u"Unexpected tag (%s)" % elt.name) continue field = data_form.Field.fromElement(elt)