def list_jinja_extensions(self): loaded_extensions = [] for name in self.yaml.get('extensions', {}).get('jinja2', []): try: value = extensions.import_extension(name, [self.root]) except ImportError: logging.error( 'Error importing %s. Module path must be relative to ' 'the pod root.', repr(name)) raise loaded_extensions.append(value) return loaded_extensions
def register_extensions(self, extension_configs): """Add new extensions to the controller.""" new_extensions = [] for config_item in extension_configs: if isinstance(config_item, basestring): extension_path = config_item config = {} else: extension_path = config_item.keys()[0] config = config_item[extension_path] cls = common_extensions.import_extension(extension_path, [self.pod.root]) ext = cls(self.pod, config) new_extensions.append(ext) self._extensions[extension_path] = ext # Register the hooks with the hook controllers. for _, hook in self._hooks.iteritems(): hook.register_extensions(new_extensions)
def register_extensions(self, extension_configs): """Add new extensions to the controller.""" new_extensions = [] for config_item in extension_configs: if isinstance(config_item, basestring): extension_path = config_item config = {} else: extension_path = config_item.keys()[0] config = config_item[extension_path] cls = common_extensions.import_extension(extension_path, [self.pod.root]) ext = cls(self.pod, config) new_extensions.append(ext) # Register the hooks with the hook controllers. for _, hook in self._hooks.iteritems(): hook.register_extensions(new_extensions)
def register_extensions(extension_paths, pod_root): for path in extension_paths: cls = extensions.import_extension(path, [pod_root]) register_preprocessor(cls)
def register_extensions(extension_paths, pod_root): for path in extension_paths: cls = extensions.import_extension(path, [pod_root]) install_translator(cls)