+
+ def __init__(self, manager, interface, config):
+ if isinstance(manager, ModuleType):
+ # old-fashioned module implementation
+ self.manager = manager
+ elif isinstance(manager, ClassType):
+ # create an instance; we don't pass the api in argument as it is passed
+ # to the actual method calls anyway
+ self.manager = manager(config)
+ else:
+ # that's what happens when there's something wrong with the db
+ # or any bad stuff of that kind at startup time
+ logger.log_exc(
+ "Failed to create a manager, startup sequence is broken")
+ raise SfaAPIError(
+ "Argument to ManagerWrapper must be a module or class")