From 2ea82e13a5722540cf03a2a54250095c19ffaf50 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 4 Apr 2024 15:35:40 +1100 Subject: [PATCH] Enable backup value option for plugin settings check (#6950) --- .../InvenTree/plugin/base/integration/SettingsMixin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/InvenTree/plugin/base/integration/SettingsMixin.py b/src/backend/InvenTree/plugin/base/integration/SettingsMixin.py index d5a5ec9a5e..92f77182fc 100644 --- a/src/backend/InvenTree/plugin/base/integration/SettingsMixin.py +++ b/src/backend/InvenTree/plugin/base/integration/SettingsMixin.py @@ -62,16 +62,19 @@ class SettingsMixin: """Does this plugin use custom global settings.""" return bool(self.settings) - def get_setting(self, key, cache=False): + def get_setting(self, key, cache=False, backup_value=None): """Return the 'value' of the setting associated with this plugin. Arguments: key: The 'name' of the setting value to be retrieved cache: Whether to use RAM cached value (default = False) + backup_value: A backup value to return if the setting is not found """ from plugin.models import PluginSetting - return PluginSetting.get_setting(key, plugin=self.plugin_config(), cache=cache) + return PluginSetting.get_setting( + key, plugin=self.plugin_config(), cache=cache, backup_value=backup_value + ) def set_setting(self, key, value, user=None): """Set plugin setting value by key."""