Enable backup value option for plugin settings check (#6950)

This commit is contained in:
Oliver 2024-04-04 15:35:40 +11:00 committed by GitHub
parent b68a1cc1b8
commit 2ea82e13a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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."""