Mercurial > libervia-backend
diff src/plugins/plugin_misc_room_game.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 | d17772b0fe22 |
line wrap: on
line diff
--- 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']