#!/usr/bin/env python # Date: Sat Jul 14 03:59:53 CDT 2007 import logging class ApplicationInterface( object ): def __init__(self, conf): raise NotImplementedError, "interface must be implemented" def handler(self, environ, start_response): raise NotImplementedError, "interface must be implemented" def initialize(self): raise NotImplementedError, "interface must be implemented" def shutdown(self): raise NotImplementedError, "interface must be implemented" class Handlers(object): logger = logging.getLogger('Handlers') def __init__(self, path): self._path = path self._handlers = {} def get(self, uri): pass def _load(self): for uri,module in self._path: module_name = module.split('.')[-1] imported_module = __import__(module, globals(), locals(), [module_name], -1) self.logger.debug('imported handler module %s' % imported_module) self._handlers[ uri ] = getattr( imported_module, module_name)(self) self.logger.debug('loaded uri handler %s' % self._handlers[uri]) # EOF