Service handler module impl. (not quite done yet)
[tss4.git] / ws / __init__.py
blob3317736113fd38b4f43410dcd045038067303c36
1 # Copyright (C) 2009 Software Institute, Nanjing University
3 __all__ = ["tql", ]
5 import inspect
8 class ServiceHandler:
10 def handle(request):
11 """Handle the request and generate an appropriate str response."""
12 pass
15 def find_handler(cmd):
16 try:
17 m = __import__('tss4.ws.%s' % cmd, {}, {}, ['ServiceHandler'])
18 for k, v in m.__dict__.items():
19 if inspect.isclass(v) and issubclass(v, (ServiceHandler,)) \
20 and k <> 'ServiceHandler':
21 handler = object.__new__(v)
22 handler.__init__()
23 return handler
24 except ImportError:
25 pass
26 return None