def load(context, manager=None): if manager: task_manager_api_class = (strategy.load_taskmanager_strategy(manager) .task_manager_api_class) else: task_manager_api_class = API return task_manager_api_class(context)
def load(context, manager=None): if manager: task_manager_api_class = ( strategy.load_taskmanager_strategy(manager).task_manager_api_class) else: task_manager_api_class = API return task_manager_api_class(context)
def __getattr__(self, name): """ We should only get here if Python couldn't find a "real" method. """ def raise_error(msg): raise AttributeError(msg) manager, sep, method = name.partition('_') if not manager: raise_error('Cannot derive manager from attribute name "%s"' % name) task_strategy = strategy.load_taskmanager_strategy(manager) if not task_strategy: raise_error('No task manager strategy for manager "%s"' % manager) if method not in task_strategy.task_manager_manager_actions: raise_error('No method "%s" for task manager strategy for manager' ' "%s"' % (method, manager)) return task_strategy.task_manager_manager_actions.get(method)