Exemplo n.º 1
0
 def make_api (self, *args, **kwargs):
     # interface is a required arg
     if not 'interface' in kwargs:
         logger.critical("Generic.make_api: no interface found")
     api = self.api_class()(*args, **kwargs)
     # xxx can probably drop support for managers implemented as modules 
     # which makes it a bit awkward
     manager_class_or_module = self.make_manager(api.interface)
     driver = self.make_driver (api)
     ### arrange stuff together
     # add a manager wrapper
     manager_wrap = ManagerWrapper(manager_class_or_module,api.interface,api.config)
     api.manager=manager_wrap
     # add it in api as well; driver.api is set too as part of make_driver
     api.driver=driver
     return api
Exemplo n.º 2
0
 def make_api(self, *args, **kwargs):
     # interface is a required arg
     if not 'interface' in kwargs:
         logger.critical("Generic.make_api: no interface found")
     api = self.api_class()(*args, **kwargs)
     # xxx can probably drop support for managers implemented as modules
     # which makes it a bit awkward
     manager_class_or_module = self.make_manager(api.interface)
     driver = self.make_driver(api)
     ### arrange stuff together
     # add a manager wrapper
     manager_wrap = ManagerWrapper(manager_class_or_module, api.interface,
                                   api.config)
     api.manager = manager_wrap
     # add it in api as well; driver.api is set too as part of make_driver
     api.driver = driver
     return api
Exemplo n.º 3
0
 def make_api (self, *args, **kwargs):
     # interface is a required arg
     if not 'interface' in kwargs:
         logger.critical("Generic.make_api: no interface found")
     api = self.api_class()(*args, **kwargs)
     # xxx can probably drop support for managers implemented as modules 
     # which makes it a bit awkward
     manager_class_or_module = self.make_manager(api.interface)
     driver = self.make_driver (api.config, api.interface)
     ### arrange stuff together
     # add a manager wrapper
     manager_wrap = ManagerWrapper(manager_class_or_module,api.interface,api.config)
     api.manager=manager_wrap
     # insert driver in manager
     logger.debug("Setting manager.driver, manager=%s"%manager_class_or_module)
     # xxx this should go into the object and not the class !?!
     manager_class_or_module.driver=driver
     # add it in api as well for convenience
     api.driver=driver
     return api