Show only "core" app settings by default

This commit is contained in:
Lance Edgar 2022-12-31 17:57:22 -06:00
parent 884f960d3b
commit a01982ae55

View file

@ -255,11 +255,20 @@ class AppSettingsView(View):
""" """
Iterate over all known settings. Iterate over all known settings.
""" """
for module in self.rattail_config.getlist('rattail', 'settings', default=['rattail.settings']): modules = self.rattail_config.getlist('rattail', 'settings')
if modules:
core_only = False
else:
modules = ['rattail.settings']
core_only = True
for module in modules:
module = import_module_path(module) module = import_module_path(module)
for name in dir(module): for name in dir(module):
obj = getattr(module, name) obj = getattr(module, name)
if isinstance(obj, type) and issubclass(obj, Setting) and obj is not Setting: if isinstance(obj, type) and issubclass(obj, Setting) and obj is not Setting:
if core_only and not obj.core:
continue
# NOTE: we set this here, and reference it elsewhere # NOTE: we set this here, and reference it elsewhere
obj.node_name = self.get_node_name(obj) obj.node_name = self.get_node_name(obj)
yield obj yield obj