[Kimchi-devel] [PATCH V2] [Wok] Fix errors in Ginger/Gingerbase/Gingers390x tests

Daniel Henrique Barboza dhbarboza82 at gmail.com
Mon Apr 4 18:09:08 UTC 2016


Reviewed-by: Daniel Barboza <dhbarboza82 at gmail.com>

This patch solves the existing unit test issues in Ginger, Ginger-base
and Gingers390x.

Thanks for this quick fix!

On 04/04/2016 02:45 PM, Lucio Correia wrote:
> Do not try to translate message when app is not found.
>
> Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
> ---
>   src/wok/message.py | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
>
> Changes in V2: applied review.
>
> diff --git a/src/wok/message.py b/src/wok/message.py
> index 7ea5711..a3794d0 100644
> --- a/src/wok/message.py
> +++ b/src/wok/message.py
> @@ -45,11 +45,11 @@ class WokMessage(object):
>           self.plugin = plugin
>   
>       def _get_translation(self):
> -        wok_app = cherrypy.tree.apps['']
> +        wok_app = cherrypy.tree.apps.get('', None)
>   
>           # get app from plugin path if specified
>           if self.plugin:
> -            app = cherrypy.tree.apps[self.plugin]
> +            app = cherrypy.tree.apps.get(self.plugin, None)
>           # if on request, try to get app from it
>           elif cherrypy.request.app:
>               app = cherrypy.request.app
> @@ -57,9 +57,12 @@ class WokMessage(object):
>           else:
>               app = wok_app
>   
> +        if app is None:
> +            return self.code
> +
>           # fallback to Wok message in case plugins raise Wok exceptions
> -        text = app.root.messages.get(self.code, None)
> -        if text is None:
> +        text = app.root.messages.get(self.code, self.code)
> +        if text == self.code and wok_app is not None:
>               app = wok_app
>               text = app.root.messages.get(self.code, self.code)
>   




More information about the Kimchi-devel mailing list