From 775b00677ba3065e563f88eb7f32d0d7e2af36ed Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 02 2018 08:05:22 +0000 Subject: Fix getting the active plugins for the project Basically if the database object isn't instantiated the backref doesn't work, so before checking if there is a relation between the project and the plugin's table, instantiate the database object. Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/lib/plugins.py b/pagure/lib/plugins.py index aa31078..09fb49c 100644 --- a/pagure/lib/plugins.py +++ b/pagure/lib/plugins.py @@ -67,7 +67,10 @@ def get_enabled_plugins(project, with_default=False): if with_default: enabled = [(Default(), None)] for plugin in load("pagure.hooks", subclasses=BaseHook): - if plugin.db_object and hasattr(project, plugin.backref): + if plugin.name == "default": + continue + plugin.db_object() + if hasattr(project, plugin.backref): dbobj = getattr(project, plugin.backref) if dbobj and dbobj.active: enabled.append((plugin, dbobj))