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

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Mon Jan 25 13:01:21 UTC 2016


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):
-- 
2.5.0




More information about the Kimchi-devel mailing list