mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-07-27 15:54:16 +00:00
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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user