Configure PROTECTION_RULE config attribute to use ConfigJSONEncoder as serializer

This commit is contained in:
atownson 2025-01-17 12:07:05 -06:00 committed by GitHub
parent 3324d64813
commit f81b0a7dab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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