diff --git a/pagure/lib/plugins.py b/pagure/lib/plugins.py index 394f449..b3a4dd3 100644 --- a/pagure/lib/plugins.py +++ b/pagure/lib/plugins.py @@ -50,17 +50,22 @@ def get_plugin(plugin_name): return plugin -def get_enabled_plugins(project): +def get_enabled_plugins(project, with_default=False): """ Returns a list of plugins enabled for a specific project. Args: project (model.Project): The project to look for. + with_default (boolean): Wether or not the returned list should + include the default hook/plugin. Returns: (list): A list of tuples (pluginclass, dbobj) with the plugin classess and dbobjects for plugins enabled for the project. """ from pagure.hooks import BaseHook + from pagure.hooks.default import Default enabled = [] + if with_default: + enabled = [(Default(), None)] for plugin in load("pagure.hooks", subclasses=BaseHook): if plugin.db_object and hasattr(project, plugin.backref): dbobj = getattr(project, plugin.backref)