Mercurial > libervia-backend
comparison src/tools/config.py @ 2451:d1153ce68ca0
tools (config): complexe data can now be set using json and the "_json" suffix
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 30 Nov 2017 20:53:47 +0100 |
parents | 8b37a62336c3 |
children | 0046283a285d |
comparison
equal
deleted
inserted
replaced
2450:124f5db998f2 | 2451:d1153ce68ca0 |
---|---|
109 value = json.loads(value) | 109 value = json.loads(value) |
110 except ValueError as e: | 110 except ValueError as e: |
111 raise exceptions.ParsingError(u"Error while parsing data: {}".format(e)) | 111 raise exceptions.ParsingError(u"Error while parsing data: {}".format(e)) |
112 if not isinstance(value, dict): | 112 if not isinstance(value, dict): |
113 raise exceptions.ParsingError(u"{name} value is not a dict: {value}".format(name=name, value=value)) | 113 raise exceptions.ParsingError(u"{name} value is not a dict: {value}".format(name=name, value=value)) |
114 elif name.endswith('_json'): | |
115 try: | |
116 value = json.loads(value) | |
117 except ValueError as e: | |
118 raise exceptions.ParsingError(u"Error while parsing data: {}".format(e)) | |
114 return value | 119 return value |