massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions

This commit is contained in:
souliane 2015-04-16 14:57:57 +02:00
commit 67ff77e5de

View file

@ -171,15 +171,15 @@ class XEP_0054(object):
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 @@ class XEP_0054(object):
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 @@ class XEP_0054(object):
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 @@ class XEP_0054(object):
"""
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