Corrected issue with encoding / decoding of dictionary and list type settings values.

Updated zone record settings management to use valid JSON format with backwards compatibility support for the non-JSON literal format.
This commit is contained in:
Matt Scott
2023-04-14 18:52:27 -04:00
parent c842d09195
commit ccd7373efe
3 changed files with 36 additions and 23 deletions

View File

@@ -597,7 +597,12 @@ class AppSettings(object):
try:
return json.loads(value)
except JSONDecodeError as e:
raise ValueError('Cannot parse json {} for variable {}'.format(value, name))
# Provide backwards compatibility for legacy non-JSON format
value = value.replace("'", '"').replace('True', 'true').replace('False', 'false')
try:
return json.loads(value)
except JSONDecodeError as e:
raise ValueError('Cannot parse json {} for variable {}'.format(value, name))
if var_type == str:
return str(value)