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

Aline Manera alinefm at linux.vnet.ibm.com
Tue Dec 13 12:59:31 UTC 2016



On 12/08/2016 08:19 AM, archus at linux.vnet.ibm.com wrote:
> 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)

It would be good to print the args as well to make easier identify the 
problem

except KeyError:
     msg = decode_value(msg) + " " + str(self.args)
>
>           if prepend_code:
>               return "%s: %s" % (self.code, msg)




More information about the Kimchi-devel mailing list