[Kimchi-devel] [PATCH] [Kimchi] Issue #190: No activity logging is shown and its break if any one entry in activity log does not have proper key

archus at linux.vnet.ibm.com archus at linux.vnet.ibm.com
Thu Dec 8 09:58:59 UTC 2016


From: Archana Singh <archus at linux.vnet.ibm.com>

Currently activity logs breaks in UI, if an error code is
changed with additional parameter. For example an error code does not have
any parameter and its logged in user-requests.data with params as empty.
And however same error code is changed to have a parameter, and hence while parsing
activity log it is expected to have parameter in params.
Due to which parsing fails with KeyError.
This fix handle the KeyError and in case of KeyError the error message will
be shown without replacing the parameter with its value.

Signed-off-by: Archana Singh <archus at linux.vnet.ibm.com>
---
 src/wok/message.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/wok/message.py b/src/wok/message.py
index ff4cbc9..460d90d 100644
--- a/src/wok/message.py
+++ b/src/wok/message.py
@@ -86,7 +86,10 @@ class WokMessage(object):
 
     def get_text(self, prepend_code=True, translate=True):
         msg = self._get_text(translate)
-        msg = decode_value(msg) % self.args
+        try:
+            msg = decode_value(msg) % self.args
+        except KeyError:
+            msg = decode_value(msg)
 
         if prepend_code:
             return "%s: %s" % (self.code, msg)
-- 
2.7.4




More information about the Kimchi-devel mailing list