Exemple #1
0
 def template_plugins(self):
     """
     Returns a list of plugin classes for run_plugins to use.
     """
     if self.setting('plugins'):
         return [TemplatePlugin.create_instance(alias, self) for alias in self.setting('plugins')]
     else:
         return TemplatePlugin.__iter__(self)
 def template_plugins(self):
     """
     Returns a list of plugin classes for run_plugins to use.
     """
     if self.setting("plugins"):
         return [TemplatePlugin.create_instance(alias, self) for alias in self.setting("plugins")]
     else:
         return [
             instance
             for instance in TemplatePlugin.__iter__(self)
             if not instance.alias in self.setting("skip-plugins")
         ]
Exemple #3
0
    def run_plugins(self):
        env = {}
        for alias in self.setting('plugins'):
            from dexy.filters.templating_plugins import TemplatePlugin
            plugin = TemplatePlugin.create_instance(alias)
            self.log_debug("Running template plugin %s" % plugin.__class__.__name__)

            try:
                new_env_vars = plugin.run()
            except Exception:
                print "error occurred processing template plugin '%s'" % alias
                raise

            if any(v in env.keys() for v in new_env_vars):
                new_keys = ", ".join(sorted(new_env_vars))
                existing_keys = ", ".join(sorted(env))
                msg = "plugin class '%s' is trying to add new keys '%s', already have '%s'"
                raise dexy.exceptions.InternalDexyProblem(msg % (plugin.__class__.__name__, new_keys, existing_keys))
            env.update(new_env_vars)
        return env
Exemple #4
0
    def run_plugins(self):
        env = {}
        for alias in self.setting('plugins'):
            from dexy.filters.templating_plugins import TemplatePlugin
            plugin = TemplatePlugin.create_instance(alias)
            self.log_debug("Running template plugin %s" % plugin.__class__.__name__)

            try:
                new_env_vars = plugin.run()
            except Exception:
                print "error occurred processing template plugin '%s'" % alias
                raise

            if any(v in env.keys() for v in new_env_vars):
                new_keys = ", ".join(sorted(new_env_vars))
                existing_keys = ", ".join(sorted(env))
                msg = "plugin class '%s' is trying to add new keys '%s', already have '%s'"
                raise dexy.exceptions.InternalDexyProblem(msg % (plugin.__class__.__name__, new_keys, existing_keys))
            env.update(new_env_vars)
        return env