
Drop get_plugin_from_request() since it wrongly assumes plugin's root URI is always /plugins/<plugin_name>, which is in fact configurable by each plugin. This patch fixes it by mapping plugin name to root URI on load time, to be used by the following patches. Signed-off-by: Lucio Correia <luciojhc@linux.vnet.ibm.com> --- src/wok/utils.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/wok/utils.py b/src/wok/utils.py index 7599e85..1d93cbc 100644 --- a/src/wok/utils.py +++ b/src/wok/utils.py @@ -44,6 +44,7 @@ from wok.exception import InvalidParameter, TimeoutExpired from wok.stringutils import decode_value +plugin_root = {} wok_log = cherrypy.log.error_log @@ -82,6 +83,10 @@ def get_enabled_plugins(): plugin_config = _load_plugin_conf(name) try: if plugin_config['wok']['enable']: + # update plugin lookup dict + uri = plugin_config['wok']['uri'] + plugin_root[name] = uri + yield (name, plugin_config) except (TypeError, KeyError): continue @@ -106,18 +111,6 @@ def get_all_tabs(): return tabs -def get_plugin_from_request(): - """ - Returns name of plugin being requested. If no plugin, returns 'wok'. - """ - script_name = cherrypy.request.script_name - split = script_name.split('/') - if len(split) > 2 and split[1] == 'plugins': - return split[2] - - return 'wok' - - def import_class(class_path): module_name, class_name = class_path.rsplit('.', 1) try: -- 1.9.1