changeset 844:f3513c8cc2e6

misc: fix unnamed arguments in format strings
author souliane <souliane@mailoo.org>
date Mon, 17 Feb 2014 14:58:26 +0100
parents efd92a645220
children 519e7f79729b
files frontends/src/primitivus/chat.py src/memory/memory.py src/plugins/plugin_misc_room_game.py src/plugins/plugin_xep_0033.py src/plugins/plugin_xep_0249.py
diffstat 5 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py	Mon Feb 17 12:25:17 2014 +0100
+++ b/frontends/src/primitivus/chat.py	Mon Feb 17 14:58:26 2014 +0100
@@ -317,7 +317,7 @@
             if self.type == "one2one":
                 self.host.x_notify.sendNotification(_("Primitivus: %s is talking to you") % from_jid)
             elif self.getUserNick().lower() in msg.lower():
-                self.host.x_notify.sendNotification(_("Primitivus: %s mentioned you in room '%s'") % (from_jid, self.target))
+                self.host.x_notify.sendNotification(_("Primitivus: %(user)s mentioned you in room '%(room)s'") % {'user': from_jid, 'room': self.target})
 
     def startGame(self, game_type, referee, players):
         """Configure the chat window to start a game"""
--- a/src/memory/memory.py	Mon Feb 17 12:25:17 2014 +0100
+++ b/src/memory/memory.py	Mon Feb 17 14:58:26 2014 +0100
@@ -473,8 +473,8 @@
             return None
 
         if not self.checkSecurityLimit(node[1], security_limit):
-            warning(_("Trying to get parameter '%s' in category '%s' without authorization!!!"
-                      % (name, category)))
+            warning(_("Trying to get parameter '%(param)s' in category '%(cat)s' without authorization!!!"
+                      % {'param': name, 'cat': category}))
             return None
 
         if node[0] == GENERAL:
@@ -720,8 +720,8 @@
             return
 
         if not self.checkSecurityLimit(node[1], security_limit):
-            warning(_("Trying to set parameter '%s' in category '%s' without authorization!!!"
-                          % (name, category)))
+            warning(_("Trying to set parameter '%(param)s' in category '%(cat)s' without authorization!!!"
+                          % {'param': name, 'cat': category}))
             return
 
         if node[0] == GENERAL:
--- a/src/plugins/plugin_misc_room_game.py	Mon Feb 17 12:25:17 2014 +0100
+++ b/src/plugins/plugin_misc_room_game.py	Mon Feb 17 14:58:26 2014 +0100
@@ -193,7 +193,7 @@
                         break
 
         if not auth and (verbose or _DEBUG):
-            debug(_("%s not allowed to join the game %s in %s") % (user_jid_s or nick, self.name, room_jid_s))
+            debug(_("%(user)s not allowed to join the game %(game)s in %(room)s") % {'user': user_jid_s or nick, 'game': self.name, 'room': room_jid_s})
         return auth
 
     def _updatePlayers(self, room_jid_s, nicks, sync, profile):
@@ -327,7 +327,7 @@
         elif self.invite_mode == self.FROM_PLAYERS:
             auth = self.isPlayer(room_jid_s, nick)
         if not auth and (verbose or _DEBUG):
-            debug(_("%s not allowed to invite for the game %s in %s") % (nick, self.name, room_jid_s))
+            debug(_("%(user)s not allowed to invite for the game %(game)s in %(room)s") % {'user': nick, 'game': self.name, 'room': room_jid_s})
         return auth
 
     def isReferee(self, room_jid_s, nick):
@@ -372,7 +372,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):
-            debug(_("Still waiting for %s before starting the game %s in %s") % (result[2], self.name, room.occupantJID.userhost()))
+            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()})
         return result
 
     def getUniqueName(self, muc_service="", profile_key='@DEFAULT@'):
@@ -499,10 +499,10 @@
         if self._gameExists(room_jid_s):
             is_referee = self.isReferee(room_jid_s, user_nick)
             if self._gameExists(room_jid_s, started=True):
-                warning(_("%s game already created in room %s") % (self.name, room_jid_s))
+                warning(_("%(game)s game already created in room %(room)s") % {'game': self.name, 'room': room_jid_s})
                 return False, is_referee
             elif not is_referee:
-                warning(_("%s game in room %s can only be created by %s") % (self.name, room_jid_s, user_nick))
+                warning(_("%(game)s game in room %(room)s can only be created by %(user)s") % {'game': self.name, 'room': room_jid_s, 'user': user_nick})
                 return False, False
         else:
             self._initGame(room_jid_s, user_nick)
@@ -515,7 +515,7 @@
         @param room_jid: JID userhost of the room
         @param nicks: list of players nicks in the room (referee included, in first position)
         @param profile_key: %(doc_profile_key)s"""
-        debug(_("Creating %s game in room %s") % (self.name, room_jid_s))
+        debug(_("Creating %(game)s game in room %(room)s") % {'game': self.name, 'room': room_jid_s})
         profile = self.host.memory.getProfileName(profile_key)
         if not profile:
             error(_("profile %s is unknown") % profile_key)
--- a/src/plugins/plugin_xep_0033.py	Mon Feb 17 12:25:17 2014 +0100
+++ b/src/plugins/plugin_xep_0033.py	Mon Feb 17 14:58:26 2014 +0100
@@ -87,7 +87,7 @@
                 if entity is None:
                     return Failure(AbortSendMessage(_("XEP-0033 is being used but the server doesn't support it!")))
                 if mess_data["to"] != entity:
-                    logging.warning(_("Stanzas using XEP-0033 should be addressed to %s, not %s!") % (entity, mess_data["to"]))
+                    logging.warning(_("Stanzas using XEP-0033 should be addressed to %(expected)s, not %(current)s!") % {'expected': entity, 'current': mess_data["to"]})
                     logging.warning(_("TODO: addressing has be fixed by the backend... fix it in the frontend!"))
                     mess_data["to"] = entity
                 element = mess_data['xml'].addElement('addresses', NS_ADDRESS)
--- a/src/plugins/plugin_xep_0249.py	Mon Feb 17 12:25:17 2014 +0100
+++ b/src/plugins/plugin_xep_0249.py	Mon Feb 17 14:58:26 2014 +0100
@@ -151,10 +151,10 @@
         if autojoin == "always":
             self._accept(room, profile)
         elif autojoin == "ask":
-            data = {"message": _("You have been invited by %s to join the room %s. Do you accept?") % (from_, room), "title": _("MUC invitation")}
+            data = {"message": _("You have been invited by %(user)s to join the room %(room)s. Do you accept?") % {'user': from_, 'room': room}, "title": _("MUC invitation")}
             self.host.askConfirmation(room, "YES/NO", data, accept_cb, profile)
         else:
-            self.host.bridge.newAlert(_("An invitation from %s to join the room %s has been declined according to your personal settings.") % (from_, room), _("MUC invitation"), "INFO", profile)
+            self.host.bridge.newAlert(_("An invitation from %(user)s to join the room %(room)s has been declined according to your personal settings.") % {'user': from_, 'room': room}, _("MUC invitation"), "INFO", profile)
 
 
 class XEP_0249_handler(XMPPHandler):