From 3d833fb6af4b8ac3f4eef696d924c43f56650cc7 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 11 Nov 2021 15:22:15 +0100 Subject: [PATCH] [plugin] Plugins should have an unique ID --- flaschengeist/plugins/__init__.py | 3 ++- flaschengeist/plugins/events/__init__.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flaschengeist/plugins/__init__.py b/flaschengeist/plugins/__init__.py index 094eae7..fabc4e2 100644 --- a/flaschengeist/plugins/__init__.py +++ b/flaschengeist/plugins/__init__.py @@ -33,6 +33,7 @@ class Plugin: blueprint = None # You have to override permissions = [] # You have to override + id = "dev.flaschengeist.plugin" # You have to override name = "plugin" # You have to override models = None # You have to override @@ -94,7 +95,7 @@ class Plugin: db.session.commit() def notify(self, user, text: str, data=None): - n = Notification(text=text, data=data, plugin=self.name, user_=user) + n = Notification(text=text, data=data, plugin=self.id, user_=user) db.session.add(n) db.session.commit() diff --git a/flaschengeist/plugins/events/__init__.py b/flaschengeist/plugins/events/__init__.py index e4a0af0..c86a214 100644 --- a/flaschengeist/plugins/events/__init__.py +++ b/flaschengeist/plugins/events/__init__.py @@ -11,6 +11,7 @@ from . import permissions, models class EventPlugin(Plugin): name = "events" + id = "dev.flaschengeist.events" plugin = LocalProxy(lambda: current_app.config["FG_PLUGINS"][EventPlugin.name]) permissions = permissions.permissions blueprint = Blueprint(name, __name__)