diff src/plugins/plugin_xep_0054.py @ 1409:3265a2639182

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