From dca52b764cc625293d805a9256aa44fda3e1c9cd Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 6 Dec 2021 23:44:41 +0100 Subject: [PATCH] fix(plugins): Setting a plugin setting to None removes that setting --- flaschengeist/plugins/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flaschengeist/plugins/__init__.py b/flaschengeist/plugins/__init__.py index bf32013..0c33ea9 100644 --- a/flaschengeist/plugins/__init__.py +++ b/flaschengeist/plugins/__init__.py @@ -96,7 +96,10 @@ class Plugin: .one_or_none() ) if setting is not None: - setting.value = value + if value is None: + db.session.delete(setting) + else: + setting.value = value else: db.session.add(_PluginSetting(plugin=self.name, name=name, value=value)) db.session.commit()