diff frontends/src/quick_frontend/quick_app.py @ 1409:3265a2639182

massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
author souliane <souliane@mailoo.org>
date Thu, 16 Apr 2015 14:57:57 +0200
parents 96dd0ae1a850
children 176de79c8c39
line wrap: on
line diff
--- 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()