Signed-off-by: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
---
src/wok/utils.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/wok/utils.py b/src/wok/utils.py
index 4c132a1..3d61e66 100644
--- a/src/wok/utils.py
+++ b/src/wok/utils.py
@@ -137,6 +137,17 @@ def get_plugin_from_request():
return 'wok'
+def get_plugin_from_uri(uri):
+ """
+ Tries to deduce plugin name from URI. If no success, returns 'wok'.
+ """
+ split = uri.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