From cdcb155accb379ae789180f703f05308ce546b20 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 2 Dec 2019 10:41:43 +0100 Subject: [PATCH] support of todict --- tiramisu/todict.py | 47 ++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/tiramisu/todict.py b/tiramisu/todict.py index 265f09f..50b7684 100644 --- a/tiramisu/todict.py +++ b/tiramisu/todict.py @@ -158,22 +158,33 @@ class Requires(object): path, form, current_action): - return - for requires in childapi.option.requires(): - len_to_long = len(requires) > 1 - for require in requires: - options, action, inverse, transitive, same_action, operator = require - if not len_to_long: - len_to_long = len(options) > 1 - for option, expected in options: + for requires in childapi.option.properties(uncalculated=True): + if not isinstance(requires, str): + option = requires.params.kwargs['condition'].option + expected = [requires.params.kwargs['expected'].value] + action = requires.params.args[0].value + if 'reverse_condition' in requires.params.kwargs: + inverse = requires.params.kwargs['reverse_condition'].value + else: + inverse = False + transitive = True + same_action = True + operator = 'or' + if 1 == 1: +# len_to_long = len(requires) > 1 +# for require in requires: +# options, action, inverse, transitive, same_action, operator = require +# if not len_to_long: +# len_to_long = len(options) > 1 +# for option, expected in options: if isinstance(option, tuple): for option_param in chain(option[1].args, option[1].kwargs.values()): if isinstance(option_param, ParamOption): self.tiramisu_web.set_remotable(option_param.option.impl_getpath(), form) self.set_master_remote(childapi, path, form) - elif len_to_long: - self.tiramisu_web.set_remotable(option.impl_getpath(), form) - self.set_master_remote(childapi, path, form) +# elif len_to_long: +# self.tiramisu_web.set_remotable(option.impl_getpath(), form) +# self.set_master_remote(childapi, path, form) else: option_path = option.impl_getpath() if action in self.action_hide: @@ -184,13 +195,13 @@ class Requires(object): # operator "and" not supported yet for a requirement self.tiramisu_web.set_remotable(option_path, form, require_option) self.set_master_remote(childapi, path, form) - if require_option.option.requires(): - for reqs in require_option.option.requires(): - for req in reqs: - for subopt, subexp in req[0]: - if not isinstance(subopt, tuple): - self.tiramisu_web.set_remotable(subopt.impl_getpath(), form) - self.set_master_remote(childapi, path, form) +# if require_option.option.requires(): +# for reqs in require_option.option.requires(): +# for req in reqs: +# for subopt, subexp in req[0]: +# if not isinstance(subopt, tuple): +# self.tiramisu_web.set_remotable(subopt.impl_getpath(), form) +# self.set_master_remote(childapi, path, form) if inverse: act = 'show' inv_act = 'hide'