summaryrefslogtreecommitdiffstats
path: root/silpa/common/modulemanager.py
diff options
context:
space:
mode:
authoraashiks <aashiks@gmail.com>2009-04-17 11:27:31 +0530
committeraashiks <aashiks@gmail.com>2009-04-17 11:27:31 +0530
commit0bc0f508ebba733e8fe8430cbd4aab9e74fdcb69 (patch)
tree8f334b7197c3771526bea0157d201e7e4bcde6f0 /silpa/common/modulemanager.py
parent58e58e8add8d6a20425b8d4b31f961fc7df87c3d (diff)
parentb4c9aab679ee466431a64688226ed870380d5b29 (diff)
downloadRachana.git-0bc0f508ebba733e8fe8430cbd4aab9e74fdcb69.tar.gz
Rachana.git-0bc0f508ebba733e8fe8430cbd4aab9e74fdcb69.tar.xz
Rachana.git-0bc0f508ebba733e8fe8430cbd4aab9e74fdcb69.zip
Merge branch 'master' of ssh://aashiks@git.sv.nongnu.org/srv/git/smc
Diffstat (limited to 'silpa/common/modulemanager.py')
-rw-r--r--silpa/common/modulemanager.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/silpa/common/modulemanager.py b/silpa/common/modulemanager.py
index 028c4ae..8f9c79d 100644
--- a/silpa/common/modulemanager.py
+++ b/silpa/common/modulemanager.py
@@ -9,16 +9,21 @@ class ModuleManager:
obj= sys.modules[name]
except KeyError:
obj = __import__(".".join(parts[:-1]))
- print "Loading " , obj
if(len(parts)>1):
for part in parts[1:]:
- obj = getattr(obj,part)
+ try:
+ obj = getattr(obj,part)
+ except:
+ obj = None
return obj
def getModuleInstance(self,action):
module_name = self.find_module(action)
if(module_name):
- return self.import_module(module_name).getInstance()
+ try:
+ return self.import_module(module_name).getInstance()
+ except:
+ print dir(self.import_module(module_name))
else:
return None
def find_module(self,action):
@@ -26,6 +31,15 @@ class ModuleManager:
return getModulesList()[action]
except:
return None
+ def getModulesInfoAsHTML(self):
+ module_dict=getModulesList ()
+ response = "<h2>Available Modules</h2></hr>"
+ response = response+"<table class=\"table1\"><tr><th>Module</th><th>Description</th><th>Status</th></tr>"
+ for action in module_dict:
+ module_instance=self.getModuleInstance(action)
+ response = response+"<tr><td><a href='?action="+ action +"'>"+module_instance.get_module_name()+"</a></td>"
+ response = response+"<td>"+module_instance.get_info()+"</td><td>OK</td></tr>"
+ return response+"</table>"
if __name__ == '__main__':
mm=ModuleManager()
print mm.getModuleInstance("lemmatize")