def _init_resource(self, key, resource): if not is_generator(resource): raise Exception('Resource {}:{} must be a Python generator callable.'.format(key, resource)) if hasattr(resource, 'setup') and callable(resource.setup): # Setup is deprecated as of 0.8.4 resource.setup(self._data_manager) self._resources[key] = resource
def register_context_middleware(self, *middleware): """ :param middleware: Middleware in order of execution """ for m in middleware: if not is_generator(m): raise Exception('Middleware {} must be a Python generator callable.'.format(m)) self._middleware.extend(middleware)
def _init_resource(self, key, resource): if not is_generator(resource): raise Exception( 'Resource {}:{} must be a Python generator callable.'.format( key, resource)) if hasattr(resource, 'setup') and callable(resource.setup): # Setup is deprecated as of 0.8.4 resource.setup(self._data_manager) self._resources[key] = resource