support of todict

This commit is contained in:
Emmanuel Garette 2019-12-02 10:41:43 +01:00
parent 27838e67a3
commit cdcb155acc

View file

@ -158,22 +158,33 @@ class Requires(object):
path, path,
form, form,
current_action): current_action):
return for requires in childapi.option.properties(uncalculated=True):
for requires in childapi.option.requires(): if not isinstance(requires, str):
len_to_long = len(requires) > 1 option = requires.params.kwargs['condition'].option
for require in requires: expected = [requires.params.kwargs['expected'].value]
options, action, inverse, transitive, same_action, operator = require action = requires.params.args[0].value
if not len_to_long: if 'reverse_condition' in requires.params.kwargs:
len_to_long = len(options) > 1 inverse = requires.params.kwargs['reverse_condition'].value
for option, expected in options: 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): if isinstance(option, tuple):
for option_param in chain(option[1].args, option[1].kwargs.values()): for option_param in chain(option[1].args, option[1].kwargs.values()):
if isinstance(option_param, ParamOption): if isinstance(option_param, ParamOption):
self.tiramisu_web.set_remotable(option_param.option.impl_getpath(), form) self.tiramisu_web.set_remotable(option_param.option.impl_getpath(), form)
self.set_master_remote(childapi, path, form) self.set_master_remote(childapi, path, form)
elif len_to_long: # elif len_to_long:
self.tiramisu_web.set_remotable(option.impl_getpath(), form) # self.tiramisu_web.set_remotable(option.impl_getpath(), form)
self.set_master_remote(childapi, path, form) # self.set_master_remote(childapi, path, form)
else: else:
option_path = option.impl_getpath() option_path = option.impl_getpath()
if action in self.action_hide: if action in self.action_hide:
@ -184,13 +195,13 @@ class Requires(object):
# operator "and" not supported yet for a requirement # operator "and" not supported yet for a requirement
self.tiramisu_web.set_remotable(option_path, form, require_option) self.tiramisu_web.set_remotable(option_path, form, require_option)
self.set_master_remote(childapi, path, form) self.set_master_remote(childapi, path, form)
if require_option.option.requires(): # if require_option.option.requires():
for reqs in require_option.option.requires(): # for reqs in require_option.option.requires():
for req in reqs: # for req in reqs:
for subopt, subexp in req[0]: # for subopt, subexp in req[0]:
if not isinstance(subopt, tuple): # if not isinstance(subopt, tuple):
self.tiramisu_web.set_remotable(subopt.impl_getpath(), form) # self.tiramisu_web.set_remotable(subopt.impl_getpath(), form)
self.set_master_remote(childapi, path, form) # self.set_master_remote(childapi, path, form)
if inverse: if inverse:
act = 'show' act = 'show'
inv_act = 'hide' inv_act = 'hide'