From 741a021ef51384619d387c03ac057fa7db6b3d7e Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Fri, 7 Oct 2016 02:35:31 +0200 Subject: [PATCH] Handle correctly weboob.tools.value.Value arguments Correctly export special arguments in the modules list JSON, typically `choices`. Close #3. --- tools/weboob_tools.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/weboob_tools.py b/tools/weboob_tools.py index 313048e..c33c461 100644 --- a/tools/weboob_tools.py +++ b/tools/weboob_tools.py @@ -5,7 +5,7 @@ from weboob.tools.value import (ValueBackendPassword, ValueInt, ValueFloat, ValueBool) -def value_to_string(value): +def Value_to_string(value): """ Convert a Value definition from Weboob to a string describing the field type. @@ -35,6 +35,15 @@ def dictify_config_desc(config): Returns: A JSON-serializable dict. """ return { - name: value_to_string(value) + name: { + "type": Value_to_string(value), + "label": value.label, + "required": value.required, + "default": value.default, + "masked": value.masked, + "regexp": value.regexp, + "choices": value.choices, + "tiny": value.tiny + } for name, value in config.items() }