
Reviewed-by: Chandra Shekhar Reddy Potula <chandra@linux.vnet.ibm.com> On 25/01/16 6:31 PM, dhbarboza82@gmail.com wrote:
From: Daniel Henrique Barboza <dhbarboza82@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@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):