support of todict

This commit is contained in:
Emmanuel Garette 2019-12-02 10:41:43 +01:00
parent 27838e67a3
commit cdcb155acc
1 changed files with 29 additions and 18 deletions

View File

@ -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'