# HG changeset patch # User Goffi # Date 1512071627 -3600 # Node ID d1153ce68ca0f76e05e75232b11870d8f0243d77 # Parent 124f5db998f2c89ed3a0357fd516bbcf7f341dbb tools (config): complexe data can now be set using json and the "_json" suffix diff -r 124f5db998f2 -r d1153ce68ca0 src/tools/config.py --- a/src/tools/config.py Thu Nov 30 20:52:33 2017 +0100 +++ b/src/tools/config.py Thu Nov 30 20:53:47 2017 +0100 @@ -111,4 +111,9 @@ raise exceptions.ParsingError(u"Error while parsing data: {}".format(e)) if not isinstance(value, dict): raise exceptions.ParsingError(u"{name} value is not a dict: {value}".format(name=name, value=value)) + elif name.endswith('_json'): + try: + value = json.loads(value) + except ValueError as e: + raise exceptions.ParsingError(u"Error while parsing data: {}".format(e)) return value