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

From: Archana Singh <archus@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@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

I will reset this patch again with correct plugin name that is Wok. On 12/08/2016 03:28 PM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@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@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)
participants (2)
-
Archana Singh
-
archus@linux.vnet.ibm.com