[Kimchi-devel] [PATCH] [Wok 2/2] Issue #115: _get_resources wok_log.error result into unicode error

Aline Manera alinefm at linux.vnet.ibm.com
Mon May 30 14:22:58 UTC 2016


Hi Archana,

Seems encode_value() is not defined:

make[2]: Entering directory '/home/alinefm/wok'
PYTHONPATH=src contrib/check_i18n.py src/wok/plugins/*/i18n.py 
src/wok/i18n.py
Checking for invalid i18n string...
Checking for invalid i18n string successfully
*./src/wok/control/base.py:382: undefined name 'encode_value'*
Makefile:930: recipe for target 'check-local' failed
make[2]: *** [check-local] Error 1
make[2]: Leaving directory '/home/alinefm/wok'
Makefile:797: recipe for target 'check-am' failed
make[1]: *** [check-am] Error 2
make[1]: Leaving directory '/home/alinefm/wok'
Makefile:509: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1

Could you fix it and resend?

Thanks,
Aline Manera


On 05/23/2016 05:13 AM, archus at linux.vnet.ibm.com wrote:
> From: Archana Singh <archus at linux.vnet.ibm.com>
>
> As ident is in encoded value but e.message is in unicode value,
> combination of which result into unicode value having encoded ident value.
> So when wok_log.error try to encode(encoded value) it result into error.
>
> This patch fix the unicode error by encoding e.message.
>
> Signed-off-by: Archana Singh <archus at linux.vnet.ibm.com>
> ---
>   src/wok/control/base.py | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/wok/control/base.py b/src/wok/control/base.py
> index be5f618..d4fd4e4 100644
> --- a/src/wok/control/base.py
> +++ b/src/wok/control/base.py
> @@ -373,9 +373,13 @@ class Collection(object):
>                       res.lookup()
>                   except Exception as e:
>                       # In case of errors when fetching a resource info, pass and
> -                    # log the error, so, other resources are returned
> +                    # log the error, so, other resources are returned.
> +                    # Encoding error message as ident is also encoded value.
> +                    # This has to be done to avoid unicode error,
> +                    # as combination of encoded and unicode value results into
> +                    # unicode error.
>                       wok_log.error("Problem in lookup of resource '%s'. "
> -                                  "Detail: %s" % (ident, e.message))
> +                                  "Detail: %s" % (ident, encode_value(e.message)))
>                       continue
>                   res_list.append(res)
>               return res_list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20160530/44f2a1ee/attachment.html>


More information about the Kimchi-devel mailing list