[Kimchi-devel] [PATCH] [WoK] Fixing loading of plug-ins without 'sub_nodes' - part 2

Chandra Shekhar Reddy Potula chandra at linux.vnet.ibm.com
Mon Jan 25 13:43:20 UTC 2016


Reviewed-by: Chandra Shekhar Reddy Potula <chandra at linux.vnet.ibm.com>

On 25/01/16 6:31 PM, dhbarboza82 at gmail.com wrote:
> From: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
>
> Further enhances the sub_nodes code by executing its
> code block if and only if the sub_nodes var is defined.
>
> Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
> ---
>   src/wok/server.py | 17 +++++++++--------
>   1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/src/wok/server.py b/src/wok/server.py
> index c2f6c65..6afa74a 100644
> --- a/src/wok/server.py
> +++ b/src/wok/server.py
> @@ -172,20 +172,21 @@ class Server(object):
>               try:
>                   sub_nodes = import_class('plugins.%s.control.sub_nodes' %
>                                            plugin_name)
> +
> +                urlSubNodes = {}
> +                for ident, node in sub_nodes.items():
> +                    if node.url_auth:
> +                        ident = "/%s" % ident
> +                        urlSubNodes[ident] = {'tools.wokauth.on': True}
> +
> +                    plugin_config.update(urlSubNodes)
> +
>               except ImportError, e:
>                   cherrypy.log.error_log.error(
>                       "Failed to import subnodes for plugin %s, "
>                       "error: %s" % (plugin_class, e.message)
>                   )
>
> -            urlSubNodes = {}
> -            for ident, node in sub_nodes.items():
> -                if node.url_auth:
> -                    ident = "/%s" % ident
> -                    urlSubNodes[ident] = {'tools.wokauth.on': True}
> -
> -                plugin_config.update(urlSubNodes)
> -
>               cherrypy.tree.mount(plugin_app, script_name, plugin_config)
>
>       def start(self):




More information about the Kimchi-devel mailing list