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

@ -205,7 +205,7 @@ class RoomGame(object):
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 @@ class RoomGame(object):
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 @@ class RoomGame(object):
(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 @@ class RoomGame(object):
@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 @@ class RoomGame(object):
# 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 @@ class RoomGame(object):
"""
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 @@ class RoomGame(object):
@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 @@ class RoomGame(object):
"""
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 @@ class RoomGame(object):
- 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']