Tweak getattr()

This commit is contained in:
Jeremy Stretch 2025-01-17 13:47:43 -05:00
parent f81b0a7dab
commit 16d2e63dac

View File

@ -571,7 +571,7 @@ class SystemView(UserPassesTestMixin, View):
# Serialize any CustomValidator classes # Serialize any CustomValidator classes
for attr in ['CUSTOM_VALIDATORS', 'PROTECTION_RULES']: for attr in ['CUSTOM_VALIDATORS', 'PROTECTION_RULES']:
if hasattr(config, attr) and getattr(config, attr): if hasattr(config, attr) and getattr(config, attr, None):
setattr(config, attr, json.dumps(getattr(config, attr), cls=ConfigJSONEncoder, indent=4)) setattr(config, attr, json.dumps(getattr(config, attr), cls=ConfigJSONEncoder, indent=4))
return render(request, 'core/system.html', { return render(request, 'core/system.html', {