コード例 #1
0
ファイル: pods.py プロジェクト: david-j-davis/grow
 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
コード例 #2
0
ファイル: pods.py プロジェクト: grow/grow
 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
コード例 #3
0
ファイル: extension_controller.py プロジェクト: grow/grow
    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)
コード例 #4
0
ファイル: extension_controller.py プロジェクト: rsau/grow
    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)
コード例 #5
0
ファイル: preprocessors.py プロジェクト: drGrove/grow
def register_extensions(extension_paths, pod_root):
    for path in extension_paths:
        cls = extensions.import_extension(path, [pod_root])
        register_preprocessor(cls)
コード例 #6
0
def register_extensions(extension_paths, pod_root):
    for path in extension_paths:
        cls = extensions.import_extension(path, [pod_root])
        install_translator(cls)
コード例 #7
0
def register_extensions(extension_paths, pod_root):
    for path in extension_paths:
        cls = extensions.import_extension(path, [pod_root])
        register_preprocessor(cls)