This commit is contained in:
Emmanuel Garette 2020-07-24 14:59:09 +02:00
parent 17e09354fa
commit d18248544c
110 changed files with 1451 additions and 1093 deletions

View File

@ -11,8 +11,6 @@ import imp
from .i18n import _ from .i18n import _
from .utils import normalize_family from .utils import normalize_family
from .error import DictConsistencyError from .error import DictConsistencyError
from .xmlreflector import HIGH_COMPATIBILITY
from .config import variable_namespace
#mode order is important #mode order is important
modes_level = ('basic', 'normal', 'expert') modes_level = ('basic', 'normal', 'expert')
@ -66,6 +64,24 @@ CONVERSION = {'number': int}
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
class SpaceAnnotator:
"""Transformations applied on a CreoleObjSpace instance
"""
def __init__(self, objectspace, eosfunc_file):
self.objectspace = objectspace
self.force_not_mandatory = []
GroupAnnotator(objectspace)
ServiceAnnotator(objectspace)
VariableAnnotator(objectspace)
ConstraintAnnotator(objectspace,
eosfunc_file,
self.force_not_mandatory,
)
FamilyAnnotator(objectspace,
self.force_not_mandatory,
)
class ServiceAnnotator: class ServiceAnnotator:
"""Manage service's object """Manage service's object
for example:: for example::
@ -78,38 +94,43 @@ class ServiceAnnotator:
</services> </services>
""" """
def __init__(self, objectspace): def __init__(self, objectspace):
self.space = objectspace.space
self.paths = objectspace.paths
self.objectspace = objectspace self.objectspace = objectspace
self.grouplist_conditions = {}
self.convert_services() self.convert_services()
def gen_family(self, def gen_family(self,
name, name,
path,
): ):
family = self.objectspace.family() family = self.objectspace.family()
family.name = name family.name = name
family.doc = name family.doc = name
family.mode = None family.mode = None
self.objectspace.paths.add_family('services',
path,
family,
)
return family return family
def convert_services(self): def convert_services(self):
if not hasattr(self.space, 'services'): if not hasattr(self.objectspace.space, 'services'):
return return
if not hasattr(self.space.services, 'service'): if not hasattr(self.objectspace.space.services, 'service'):
del self.space.services del self.objectspace.space.services
return return
self.space.services.hidden = True self.objectspace.space.services.hidden = True
families = {} families = {}
for idx, service_name in enumerate(self.space.services.service.keys()): for idx, service_name in enumerate(self.objectspace.space.services.service.keys()):
service = self.space.services.service[service_name] service = self.objectspace.space.services.service[service_name]
new_service = self.objectspace.service() new_service = self.objectspace.service()
for elttype, values in vars(service).items(): for elttype, values in vars(service).items():
if elttype == 'name' or elttype in ERASED_ATTRIBUTES: if elttype == 'name' or elttype in ERASED_ATTRIBUTES:
setattr(new_service, elttype, values) setattr(new_service, elttype, values)
continue continue
eltname = elttype + 's' eltname = elttype + 's'
family = self.gen_family(eltname) path = '.'.join(['services', eltname])
family = self.gen_family(eltname,
path,
)
if isinstance(values, dict): if isinstance(values, dict):
values = list(values.values()) values = list(values.values())
family.family = self.make_group_from_elts(service_name, family.family = self.make_group_from_elts(service_name,
@ -119,7 +140,7 @@ class ServiceAnnotator:
) )
setattr(new_service, elttype, family) setattr(new_service, elttype, family)
families[service_name] = new_service families[service_name] = new_service
self.space.services.service = families self.objectspace.space.services.service = families
def make_group_from_elts(self, def make_group_from_elts(self,
service_name, service_name,
@ -151,16 +172,11 @@ class ServiceAnnotator:
c_name = elt.source c_name = elt.source
else: else:
c_name = elt.name c_name = elt.name
family = self.gen_family(c_name)
family.variable = []
subpath = '{}.{}'.format(path, c_name) subpath = '{}.{}'.format(path, c_name)
family = self.gen_family(c_name, subpath)
family.variable = []
listname = '{}list'.format(name) listname = '{}list'.format(name)
activate_path = '.'.join([subpath, 'activate']) activate_path = '.'.join([subpath, 'activate'])
if elt in self.grouplist_conditions:
# FIXME transformer le activate qui disparait en boolean
self.objectspace.list_conditions.setdefault(listname,
{}).setdefault(self.grouplist_conditions[elt],
[]).append(activate_path)
for key in dir(elt): for key in dir(elt):
if key.startswith('_') or key.endswith('_type') or key in ERASED_ATTRIBUTES: if key.startswith('_') or key.endswith('_type') or key in ERASED_ATTRIBUTES:
continue continue
@ -213,7 +229,10 @@ class ServiceAnnotator:
type_ = 'string' type_ = 'string'
variable.type = type_ variable.type = type_
if type_ == 'symlink': if type_ == 'symlink':
variable.opt = value variable.opt = self.objectspace.paths.get_variable_path(value,
'services',
)
# variable.opt = value
variable.multi = None variable.multi = None
else: else:
variable.doc = key variable.doc = key
@ -221,7 +240,7 @@ class ServiceAnnotator:
val.type = type_ val.type = type_
val.name = value val.name = value
variable.value = [val] variable.value = [val]
self.paths.add_variable('services', self.objectspace.paths.add_variable('services',
path, path,
'service', 'service',
False, False,
@ -279,75 +298,62 @@ class ServiceAnnotator:
'for {}').format(file_.name)) 'for {}').format(file_.name))
class SpaceAnnotator(object): class GroupAnnotator:
"""Transformations applied on a CreoleObjSpace instance def __init__(self,
""" objectspace,
def __init__(self, objectspace, eosfunc_file): ):
self.paths = objectspace.paths
self.space = objectspace.space
self.objectspace = objectspace self.objectspace = objectspace
self.valid_enums = {} if not hasattr(self.objectspace.space, 'constraints') or not hasattr(self.objectspace.space.constraints, 'group'):
self.force_value = {} return
self.force_not_mandatory = []
if eosfunc_file:
self.eosfunc = imp.load_source('eosfunc', eosfunc_file)
else:
self.eosfunc = None
if HIGH_COMPATIBILITY:
self.has_hidden_if_in_condition = []
self.convert_variable()
self.convert_auto_freeze()
self.convert_groups() self.convert_groups()
self.filter_check()
self.filter_condition()
self.convert_valid_enums()
self.convert_check()
self.convert_fill()
self.remove_empty_families()
self.change_variable_mode()
self.change_family_mode()
self.dynamic_families()
self.filter_separators()
self.absolute_path_for_symlink_in_services()
self.convert_helps()
if hasattr(self.space, 'constraints'):
del self.space.constraints.index
del self.space.constraints.namespace
if vars(self.space.constraints):
raise Exception('constraints again?')
del self.space.constraints
def absolute_path_for_symlink_in_services(self): def convert_groups(self): # pylint: disable=C0111
if not hasattr(self.space, 'services'): for group in self.objectspace.space.constraints.group:
return leader_fullname = group.leader
for family_name, family in vars(self.space.services).items(): leader_family_name = self.objectspace.paths.get_variable_family_name(leader_fullname)
if not isinstance(family, dict): leader_name = self.objectspace.paths.get_variable_name(leader_fullname)
continue namespace = self.objectspace.paths.get_variable_namespace(leader_fullname)
for fam in family.values(): if '.' not in leader_fullname:
for fam1_name, fam1 in vars(fam).items(): leader_fullname = '.'.join([namespace, leader_family_name, leader_fullname])
if fam1_name == 'name' or fam1_name in ERASED_ATTRIBUTES: follower_names = list(group.follower.keys())
continue has_a_leader = False
for fam2 in fam1.family: ori_leader_family = self.objectspace.paths.get_family_obj(leader_fullname.rsplit('.', 1)[0])
for variable in fam2.variable: for variable in list(ori_leader_family.variable.values()):
if variable.type == 'symlink' and '.' not in variable.name: if has_a_leader:
variable.opt = self.paths.get_variable_path(variable.opt, # it's a follower
variable_namespace, self.manage_follower(namespace,
leader_family_name,
variable,
leader_name,
follower_names,
leader_space,
leader_is_hidden,
) )
ori_leader_family.variable.pop(variable.name)
def convert_helps(self): if follower_names == []:
# FIXME l'aide doit etre dans la variable! # no more follower
if not hasattr(self.space, 'help'): break
return elif variable.name == leader_name:
helps = self.space.help # it's a leader
if hasattr(helps, 'variable'): if isinstance(variable, self.objectspace.Leadership):
for hlp in helps.variable.values(): # append follower to an existed leadership
variable = self.paths.get_variable_obj(hlp.name) leader_space = variable
variable.help = hlp.text # if variable.hidden:
if hasattr(helps, 'family'): # leader_is_hidden = True
for hlp in helps.family.values(): else:
variable = self.paths.get_family_obj(hlp.name) leader_space = self.objectspace.Leadership()
variable.help = hlp.text leader_is_hidden = self.manage_leader(leader_space,
del self.space.help leader_family_name,
leader_name,
namespace,
variable,
group,
leader_fullname,
)
has_a_leader = True
else:
raise DictConsistencyError(_('cannot found followers {}').format(follower_names))
del self.objectspace.space.constraints.group
def manage_leader(self, def manage_leader(self,
leader_space: 'Leadership', leader_space: 'Leadership',
@ -373,17 +379,19 @@ class SpaceAnnotator(object):
variable.hidden = None variable.hidden = None
if hasattr(group, 'description'): if hasattr(group, 'description'):
leader_space.doc = group.description leader_space.doc = group.description
else: elif hasattr(variable, 'description'):
leader_space.doc = variable.description leader_space.doc = variable.description
else:
leader_space.doc = variable.name
leader_path = namespace + '.' + leader_family_name + '.' + leader_name leader_path = namespace + '.' + leader_family_name + '.' + leader_name
self.paths.add_family(namespace, self.objectspace.paths.add_family(namespace,
leader_path, leader_path,
leader_space, leader_space,
) )
leader_family = self.space.variables[namespace].family[leader_family_name] leader_family = self.objectspace.space.variables[namespace].family[leader_family_name]
leader_family.variable[leader_name] = leader_space leader_family.variable[leader_name] = leader_space
leader_space.variable.append(variable) leader_space.variable.append(variable)
self.paths.set_leader(namespace, self.objectspace.paths.set_leader(namespace,
leader_family_name, leader_family_name,
leader_name, leader_name,
leader_name, leader_name,
@ -407,127 +415,25 @@ class SpaceAnnotator(object):
variable.frozen = True variable.frozen = True
variable.force_default_on_freeze = True variable.force_default_on_freeze = True
leader_space.variable.append(variable) # pylint: disable=E1101 leader_space.variable.append(variable) # pylint: disable=E1101
self.paths.set_leader(namespace, self.objectspace.paths.set_leader(namespace,
leader_family_name, leader_family_name,
variable.name, variable.name,
leader_name, leader_name,
) )
def convert_groups(self): # pylint: disable=C0111
if hasattr(self.space, 'constraints') and hasattr(self.space.constraints, 'group'):
for group in self.space.constraints.group:
leader_fullname = group.leader
follower_names = list(group.follower.keys())
leader_family_name = self.paths.get_variable_family_name(leader_fullname)
namespace = self.paths.get_variable_namespace(leader_fullname)
leader_name = self.paths.get_variable_name(leader_fullname)
ori_leader_family = self.space.variables[namespace].family[leader_family_name]
has_a_leader = False
for variable in list(ori_leader_family.variable.values()):
if isinstance(variable, self.objectspace.Leadership):
# append follower to an existed leadership
if variable.name == leader_name:
leader_space = variable
has_a_leader = True
else:
if has_a_leader:
# it's a follower
self.manage_follower(namespace,
leader_family_name,
variable,
leader_name,
follower_names,
leader_space,
leader_is_hidden,
)
ori_leader_family.variable.pop(variable.name)
if follower_names == []:
# no more follower
break
elif variable.name == leader_name:
# it's a leader
leader_space = self.objectspace.Leadership()
leader_is_hidden = self.manage_leader(leader_space,
leader_family_name,
leader_name,
namespace,
variable,
group,
leader_fullname,
)
has_a_leader = True
else:
raise DictConsistencyError(_('cannot found followers {}').format(follower_names))
del self.space.constraints.group
def remove_empty_families(self): # pylint: disable=C0111,R0201 class VariableAnnotator:
if hasattr(self.space, 'variables'): def __init__(self,
for family in self.space.variables.values(): objectspace,
if hasattr(family, 'family'): ):
space = family.family self.objectspace = objectspace
removed_families = [] self.convert_variable()
for family_name, family in space.items(): self.convert_helps()
if not hasattr(family, 'variable') or len(family.variable) == 0: self.convert_auto_freeze()
removed_families.append(family_name) self.convert_separators()
del space[family_name]
# remove help too
if hasattr(self.space, 'help') and hasattr(self.space.help, 'family'):
for family in self.space.help.family.keys():
if family in removed_families:
del self.space.help.family[family]
def change_family_mode(self): # pylint: disable=C0111
if not hasattr(self.space, 'variables'):
return
for family in self.space.variables.values():
if hasattr(family, 'family'):
for family in family.family.values():
mode = modes_level[-1]
for variable in family.variable.values():
if isinstance(variable, self.objectspace.Leadership):
variable_mode = variable.variable[0].mode
variable.variable[0].mode = None
variable.mode = variable_mode
else:
variable_mode = variable.mode
if variable_mode is not None and modes[mode] > modes[variable_mode]:
mode = variable_mode
family.mode = mode
def dynamic_families(self): # pylint: disable=C0111
if not hasattr(self.space, 'variables'):
return
for family in self.space.variables.values():
if hasattr(family, 'family'):
for family in family.family.values():
if 'dynamic' in vars(family):
namespace = self.paths.get_variable_namespace(family.dynamic)
varpath = self.paths.get_variable_path(family.dynamic, namespace)
family.dynamic = varpath
def annotate_variable(self, variable, family_mode, path, is_follower=False):
# if the variable is mandatory and doesn't have any value
# then the variable's mode is set to 'basic'
has_value = hasattr(variable, 'value')
if variable.mandatory is True and (not has_value or is_follower):
variable.mode = modes_level[0]
if variable.mode != None and modes[variable.mode] < modes[family_mode] and (not is_follower or variable.mode != modes_level[0]):
variable.mode = family_mode
if has_value and path not in self.force_not_mandatory:
variable.mandatory = True
if variable.hidden is True:
variable.frozen = True
if not variable.auto_save is True and 'force_default_on_freeze' not in vars(variable):
variable.force_default_on_freeze = True
def convert_variable(self): def convert_variable(self):
if not hasattr(self.space, 'variables'): def _convert_variable(variable):
return
for families in self.space.variables.values():
if hasattr(families, 'family'):
for family in families.family.values():
if hasattr(family, 'variable'):
for variable in family.variable.values():
if not hasattr(variable, 'type'): if not hasattr(variable, 'type'):
variable.type = 'string' variable.type = 'string'
if variable.type != 'symlink' and not hasattr(variable, 'description'): if variable.type != 'symlink' and not hasattr(variable, 'description'):
@ -537,247 +443,148 @@ class SpaceAnnotator(object):
if not hasattr(value, 'type'): if not hasattr(value, 'type'):
value.type = variable.type value.type = variable.type
def convert_auto_freeze(self): # pylint: disable=C0111 def _convert_valid_enum(namespace,
if hasattr(self.space, 'variables'): variable,
for variables in self.space.variables.values(): path,
if hasattr(variables, 'family'): ):
for family in variables.family.values(): if variable.type in FORCE_CHOICE:
check = self.objectspace.check()
check.name = 'valid_enum'
check.target = path
check.namespace = namespace
param = self.objectspace.param()
param.text = str(FORCE_CHOICE[variable.type])
check.param = [param]
if not hasattr(self.objectspace.space, 'constraints'):
self.objectspace.space.constraints = self.objectspace.constraints()
self.objectspace.space.constraints.namespace = namespace
if not hasattr(self.objectspace.space.constraints, 'check'):
self.objectspace.space.constraints.check = []
self.objectspace.space.constraints.check.append(check)
variable.type = 'string'
if not hasattr(self.objectspace.space, 'variables'):
return
for families in self.objectspace.space.variables.values():
namespace = families.name
if hasattr(families, 'family'):
for family in families.family.values():
if hasattr(family, 'variable'): if hasattr(family, 'variable'):
for variable in family.variable.values(): for variable in family.variable.values():
if isinstance(variable, self.objectspace.Leadership):
for follower in variable.variable:
path = '{}.{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name, follower.name)
_convert_variable(follower)
_convert_valid_enum(namespace,
follower,
path,
)
else:
path = '{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name)
_convert_variable(variable)
_convert_valid_enum(namespace,
variable,
path,
)
def convert_helps(self):
if not hasattr(self.objectspace.space, 'help'):
return
helps = self.objectspace.space.help
if hasattr(helps, 'variable'):
for hlp in helps.variable.values():
variable = self.objectspace.paths.get_variable_obj(hlp.name)
variable.help = hlp.text
if hasattr(helps, 'family'):
for hlp in helps.family.values():
variable = self.objectspace.paths.get_family_obj(hlp.name)
variable.help = hlp.text
del self.objectspace.space.help
def convert_auto_freeze(self): # pylint: disable=C0111
def _convert_auto_freeze(variable, namespace):
if variable.auto_freeze: if variable.auto_freeze:
new_condition = self.objectspace.condition() new_condition = self.objectspace.condition()
new_condition.name = 'auto_hidden_if_not_in' new_condition.name = 'auto_hidden_if_not_in'
new_condition.namespace = variables.name new_condition.namespace = namespace
new_condition.source = FREEZE_AUTOFREEZE_VARIABLE new_condition.source = FREEZE_AUTOFREEZE_VARIABLE
new_param = self.objectspace.param() new_param = self.objectspace.param()
new_param.text = 'oui' new_param.text = 'oui'
new_condition.param = [new_param] new_condition.param = [new_param]
new_target = self.objectspace.target() new_target = self.objectspace.target()
new_target.type = 'variable' new_target.type = 'variable'
if variables.name == variable_namespace: path = variable.namespace + '.' + normalize_family(family.name) + '.' + variable.name
path = variable.name
else:
path = variable.namespace + '.' + family.name + '.' + variable.name
new_target.name = path new_target.name = path
new_condition.target = [new_target] new_condition.target = [new_target]
if not hasattr(self.space.constraints, 'condition'): if not hasattr(self.objectspace.space.constraints, 'condition'):
self.space.constraints.condition = [] self.objectspace.space.constraints.condition = []
self.space.constraints.condition.append(new_condition) self.objectspace.space.constraints.condition.append(new_condition)
if hasattr(self.objectspace.space, 'variables'):
def _set_valid_enum(self, variable, values, type_): for variables in self.objectspace.space.variables.values():
variable.mandatory = True if hasattr(variables, 'family'):
variable.choice = []
choices = []
for value in values:
choice = self.objectspace.choice()
try:
if type_ in CONVERSION:
choice.name = CONVERSION[type_](value)
else:
choice.name = str(value)
except:
raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{value}" is not a valid "{type_}" for "{variable.name}"'))
choices.append(choice.name)
choice.type = type_
variable.choice.append(choice)
if not variable.choice:
raise DictConsistencyError(_('empty valid enum is not allowed for variable {}').format(variable.name))
if hasattr(variable, 'value'):
for value in variable.value:
value.type = type_
if type_ in CONVERSION:
cvalue = CONVERSION[type_](value.name)
else:
cvalue = value.name
if cvalue not in choices:
raise DictConsistencyError(_('value "{}" of variable "{}" is not in list of all expected values ({})').format(value.name, variable.name, choices))
else:
new_value = self.objectspace.value()
new_value.name = values[0]
new_value.type = type_
variable.value = [new_value]
variable.type = 'choice'
def _convert_valid_enum(self, variable, path):
if variable.type in FORCE_CHOICE:
if path in self.valid_enums:
raise DictConsistencyError(_('cannot set valid enum for variable with type {}').format(variable.type))
self._set_valid_enum(variable, FORCE_CHOICE[variable.type], 'string')
if path in self.valid_enums:
values = self.valid_enums[path]['values']
self._set_valid_enum(variable, values, variable.type)
del self.valid_enums[path]
if path in self.force_value:
new_value = self.objectspace.value()
new_value.name = self.force_value[path]
new_value.type = variable.type
variable.value = [new_value]
del self.force_value[path]
def convert_valid_enums(self): # pylint: disable=C0111
if not hasattr(self.space, 'variables'):
return
for variables in self.space.variables.values():
namespace = variables.name namespace = variables.name
if hasattr(variables, 'family'):
for family in variables.family.values(): for family in variables.family.values():
if hasattr(family, 'variable'): if hasattr(family, 'variable'):
for variable in family.variable.values(): for variable in family.variable.values():
if isinstance(variable, self.objectspace.Leadership): if isinstance(variable, self.objectspace.Leadership):
for follower in variable.variable: for follower in variable.variable:
path = '{}.{}.{}.{}'.format(namespace, family.name, variable.name, follower.name) _convert_auto_freeze(follower, namespace)
self._convert_valid_enum(follower, path)
else: else:
path = '{}.{}.{}'.format(namespace, family.name, variable.name) _convert_auto_freeze(variable, namespace)
self._convert_valid_enum(variable, path)
# valid_enums must be empty now (all information are store in objects)
if self.valid_enums:
raise DictConsistencyError(_('valid_enum sets for unknown variables {}').format(self.valid_enums.keys()))
def change_variable_mode(self): # pylint: disable=C0111 def convert_separators(self): # pylint: disable=C0111,R0201
if not hasattr(self.space, 'variables'): if not hasattr(self.objectspace.space, 'variables'):
return return
for variables in self.space.variables.values(): for family in self.objectspace.space.variables.values():
if hasattr(variables, 'family'):
for family in variables.family.values():
family_mode = family.mode
if hasattr(family, 'variable'):
for variable in family.variable.values():
if isinstance(variable, self.objectspace.Leadership):
mode = modes_level[-1]
for follower in variable.variable:
if follower.auto_save is True:
raise DictConsistencyError(_('leader/followers {} '
'could not be '
'auto_save').format(follower.name))
if follower.auto_freeze is True:
raise DictConsistencyError(_('leader/followers {} '
'could not be '
'auto_freeze').format(follower.name))
if HIGH_COMPATIBILITY and variable.name != follower.name: # and variable.variable[0].mode != modes_level[0]:
is_follower = True
else:
is_follower = False
path = '{}.{}.{}'.format(family.path, variable.name, follower.name)
self.annotate_variable(follower, family_mode, path, is_follower)
# leader's mode is minimum level
if modes[variable.variable[0].mode] > modes[follower.mode]:
follower.mode = variable.variable[0].mode
variable.mode = variable.variable[0].mode
else:
# auto_save's variable is set in 'basic' mode if its mode is 'normal'
if variable.auto_save is True and variable.mode != modes_level[-1]:
variable.mode = modes_level[0]
# auto_freeze's variable is set in 'basic' mode if its mode is 'normal'
if variable.auto_freeze is True and variable.mode != modes_level[-1]:
variable.mode = modes_level[0]
path = '{}.{}'.format(family.path, variable.name)
self.annotate_variable(variable, family_mode, path)
def convert_fill(self): # pylint: disable=C0111,R0912
if not hasattr(self.space, 'constraints') or not hasattr(self.space.constraints, 'fill'):
return
# sort fill/auto by index
fills = {fill.index: fill for idx, fill in enumerate(self.space.constraints.fill)}
indexes = list(fills.keys())
indexes.sort()
targets = []
eosfunc = dir(self.eosfunc)
for idx in indexes:
fill = fills[idx]
# test if it's redefined calculation
if fill.target in targets and not fill.redefine:
raise DictConsistencyError(_(f"A fill already exists for the target: {fill.target}"))
targets.append(fill.target)
#
if not fill.name in eosfunc:
raise DictConsistencyError(_('cannot find fill function {}').format(fill.name))
namespace = fill.namespace
# let's replace the target by the path
fill.target = self.paths.get_variable_path(fill.target,
namespace)
value = self.objectspace.value()
value.type = 'calculation'
value.name = fill.name
if hasattr(fill, 'param'):
param_to_delete = []
for fill_idx, param in enumerate(fill.param):
if param.type not in TYPE_PARAM_FILL:
raise DictConsistencyError(_(f'cannot use {param.type} type as a param in a fill/auto'))
if param.type != 'string' and not hasattr(param, 'text'):
raise DictConsistencyError(_(f"All '{param.type}' variables shall have a value in order to calculate {fill.target}"))
if param.type == 'variable':
try:
param.text, suffix = self.paths.get_variable_path(param.text,
namespace,
with_suffix=True)
if suffix:
param.suffix = suffix
except DictConsistencyError as err:
if param.optional is False:
raise err
param_to_delete.append(fill_idx)
continue
else:
param.notraisepropertyerror = None
param_to_delete.sort(reverse=True)
for param_idx in param_to_delete:
fill.param.pop(param_idx)
value.param = fill.param
variable = self.paths.get_variable_obj(fill.target)
variable.value = [value]
del self.space.constraints.fill
def filter_separators(self): # pylint: disable=C0111,R0201
if not hasattr(self.space, 'variables'):
return
for family in self.space.variables.values():
if not hasattr(family, 'separators'): if not hasattr(family, 'separators'):
continue continue
if hasattr(family.separators, 'separator'): if hasattr(family.separators, 'separator'):
for idx, separator in enumerate(family.separators.separator): for idx, separator in enumerate(family.separators.separator):
option = self.paths.get_variable_obj(separator.name) option = self.objectspace.paths.get_variable_obj(separator.name)
if hasattr(option, 'separator'): if hasattr(option, 'separator'):
subpath = self.paths.get_variable_path(separator.name, subpath = self.objectspace.paths.get_variable_path(separator.name,
separator.namespace, separator.namespace,
) )
raise DictConsistencyError(_('{} already has a separator').format(subpath)) raise DictConsistencyError(_('{} already has a separator').format(subpath))
option.separator = separator.text option.separator = separator.text
del family.separators del family.separators
def load_params_in_validenum(self, param):
if param.type in ['string', 'python', 'number']: class ConstraintAnnotator:
if not hasattr(param, 'text') and (param.type == 'python' or param.type == 'number'): def __init__(self,
raise DictConsistencyError(_("All '{}' variables shall be set in order to calculate {}").format(param.type, 'valid_enum')) objectspace,
if param.type in ['string', 'number']: eosfunc_file,
try: force_not_mandatory,
values = literal_eval(param.text) ):
except ValueError: if not hasattr(objectspace.space, 'constraints'):
raise DictConsistencyError(_('Cannot load {}').format(param.text)) return
elif param.type == 'python': self.objectspace = objectspace
try: self.eosfunc = imp.load_source('eosfunc', eosfunc_file)
#values = eval(param.text, {'eosfunc': self.eosfunc, '__builtins__': {'range': range, 'str': str}}) self.valid_enums = {}
values = eval(param.text, {'eosfunc': self.eosfunc, '__builtins__': {'range': range, 'str': str}}) self.force_not_mandatory = force_not_mandatory
except NameError: if hasattr(self.objectspace.space.constraints, 'check'):
raise DictConsistencyError(_('The function {} is unknown').format(param.text)) self.check_check()
if not isinstance(values, list): self.check_replace_text()
raise DictConsistencyError(_('Function {} shall return a list').format(param.text)) self.check_valid_enum()
new_values = [] self.check_change_warning()
for val in values: self.convert_check()
new_values.append(val) if hasattr(self.objectspace.space.constraints, 'condition'):
values = new_values self.check_params_target()
else: self.filter_targets()
values = param.text self.convert_xxxlist_to_variable()
return values self.check_condition_fallback_optional()
self.check_choice_option_condition()
self.remove_condition_with_empty_target()
self.convert_condition()
if hasattr(self.objectspace.space.constraints, 'fill'):
self.convert_fill()
self.remove_constraints()
def check_check(self): def check_check(self):
remove_indexes = [] remove_indexes = []
functions = dir(self.eosfunc) functions = dir(self.eosfunc)
functions.extend(['valid_enum', 'valid_in_network', 'valid_differ']) functions.extend(['valid_enum', 'valid_in_network', 'valid_differ'])
for check_idx, check in enumerate(self.space.constraints.check): for check_idx, check in enumerate(self.objectspace.space.constraints.check):
if not check.name in functions: if not check.name in functions:
raise DictConsistencyError(_('cannot find check function {}').format(check.name)) raise DictConsistencyError(_('cannot find check function {}').format(check.name))
if hasattr(check, 'param'): if hasattr(check, 'param'):
@ -785,7 +592,7 @@ class SpaceAnnotator(object):
for idx, param in enumerate(check.param): for idx, param in enumerate(check.param):
if param.type not in TYPE_PARAM_CHECK: if param.type not in TYPE_PARAM_CHECK:
raise DictConsistencyError(_('cannot use {} type as a param in check for {}').format(param.type, check.target)) raise DictConsistencyError(_('cannot use {} type as a param in check for {}').format(param.type, check.target))
if param.type == 'variable' and not self.paths.path_is_defined(param.text): if param.type == 'variable' and not self.objectspace.paths.path_is_defined(param.text):
if param.optional is True: if param.optional is True:
param_option_indexes.append(idx) param_option_indexes.append(idx)
else: else:
@ -800,90 +607,318 @@ class SpaceAnnotator(object):
remove_indexes.append(check_idx) remove_indexes.append(check_idx)
remove_indexes.sort(reverse=True) remove_indexes.sort(reverse=True)
for idx in remove_indexes: for idx in remove_indexes:
del self.space.constraints.check[idx] del self.objectspace.space.constraints.check[idx]
def check_replace_text(self): def check_replace_text(self):
for check_idx, check in enumerate(self.space.constraints.check): for check_idx, check in enumerate(self.objectspace.space.constraints.check):
if hasattr(check, 'param'): if hasattr(check, 'param'):
namespace = check.namespace namespace = check.namespace
for idx, param in enumerate(check.param): for idx, param in enumerate(check.param):
if param.type == 'variable': if param.type == 'variable':
param.text = self.paths.get_variable_path(param.text, namespace) param.text = self.objectspace.paths.get_variable_path(param.text, namespace)
check.is_in_leadership = self.paths.get_leader(check.target) != None check.is_in_leadership = self.objectspace.paths.get_leader(check.target) != None
# let's replace the target by the path # let's replace the target by the path
check.target = self.paths.get_variable_path(check.target, namespace) check.target = self.objectspace.paths.get_variable_path(check.target, namespace)
def check_valid_enum(self): def check_valid_enum(self):
remove_indexes = [] remove_indexes = []
for idx, check in enumerate(self.space.constraints.check): for idx, check in enumerate(self.objectspace.space.constraints.check):
if check.name == 'valid_enum': if check.name == 'valid_enum':
proposed_value_type = False
remove_params = []
for param_idx, param in enumerate(check.param):
if hasattr(param, 'name') and param.name == 'checkval':
try:
proposed_value_type = self.objectspace.convert_boolean(param.text) == False
remove_params.append(param_idx)
except TypeError as err:
raise DictConsistencyError(_('cannot load checkval value for variable {}: {}').format(check.target, err))
if proposed_value_type:
# no more supported
raise DictConsistencyError(_('cannot load checkval value for variable {}, no more supported').format(check.target))
remove_params.sort(reverse=True)
for param_idx in remove_params:
del check.param[param_idx]
if len(check.param) != 1: if len(check.param) != 1:
raise DictConsistencyError(_('cannot set more than one param ' raise DictConsistencyError(_(f'cannot set more than one param for valid_enum for variable {check.target}'))
'for valid_enum for variable {}'
'').format(check.target))
param = check.param[0] param = check.param[0]
if check.target in self.valid_enums: if check.target in self.valid_enums:
raise DictConsistencyError(_('valid_enum already set for {}' raise DictConsistencyError(_(f'valid_enum already set for {check.target}'))
'').format(check.target)) if param.type not in ['string', 'python', 'number']:
if proposed_value_type: raise DictConsistencyError(_(f'unknown type {param.type} for param in valid_enum for {check.target}'))
if param.type == 'variable': variable = self.objectspace.paths.get_variable_obj(check.target)
try: values = self.load_params_in_validenum(param,
values = self.load_params_in_validenum(param) variable.name,
except NameError as err: variable.type,
raise DictConsistencyError(_('cannot load value for variable {}: {}').format(check.target, err)) )
add_default_value = not check.is_in_leadership
if add_default_value and values:
self.force_value[check.target] = values[0]
else:
values = self.load_params_in_validenum(param)
self.valid_enums[check.target] = {'type': param.type, self.valid_enums[check.target] = {'type': param.type,
'values': values} 'values': values}
self._set_valid_enum(variable,
values,
variable.type,
)
remove_indexes.append(idx) remove_indexes.append(idx)
remove_indexes.sort(reverse=True) remove_indexes.sort(reverse=True)
for idx in remove_indexes: for idx in remove_indexes:
del self.space.constraints.check[idx] del self.objectspace.space.constraints.check[idx]
def load_params_in_validenum(self,
param,
variable_name,
variable_type,
):
if not hasattr(param, 'text') and (param.type == 'python' or param.type == 'number'):
raise DictConsistencyError(_(f"All '{param.type}' variables shall be set in order to calculate valid_enum for variable {variable_name}"))
if variable_type == 'string' and param.type == 'number':
raise DictConsistencyError(_(f'Unconsistency valid_enum type ({param.type}), for variable {variable_name}'))
if param.type == 'python':
try:
values = eval(param.text, {'eosfunc': self.eosfunc, '__builtins__': {'range': range, 'str': str}})
except NameError:
raise DictConsistencyError(_('The function {} is unknown').format(param.text))
else:
try:
values = literal_eval(param.text)
except ValueError:
raise DictConsistencyError(_(f'Cannot load {param.text} in valid_enum'))
if not isinstance(values, list):
raise DictConsistencyError(_('Function {} shall return a list').format(param.text))
for value in values:
if variable_type == 'string' and not isinstance(value, str):
raise DictConsistencyError(_(f'Cannot load "{param.text}", "{value}" is not a string'))
if variable_type == 'number' and not isinstance(value, int):
raise DictConsistencyError(_(f'Cannot load "{param.text}", "{value}" is not a number'))
return values
def check_change_warning(self): def check_change_warning(self):
#convert level to "warnings_only" #convert level to "warnings_only"
for check in self.space.constraints.check: for check in self.objectspace.space.constraints.check:
if check.level == 'warning': if check.level == 'warning':
check.warnings_only = True check.warnings_only = True
else: else:
check.warnings_only = False check.warnings_only = False
check.level = None check.level = None
def filter_check(self): # pylint: disable=C0111 def _get_family_variables_from_target(self,
# valid param in check target,
if not hasattr(self.space, 'constraints') or not hasattr(self.space.constraints, 'check'): ):
return if target.type == 'variable':
self.check_check() variable = self.objectspace.paths.get_variable_obj(target.name)
self.check_replace_text() family = self.objectspace.paths.get_family_obj(target.name.rsplit('.', 1)[0])
self.check_valid_enum() if isinstance(family, self.objectspace.Leadership) and family.name == variable.name:
self.check_change_warning() return family, family.variable
if not self.space.constraints.check: return variable, [variable]
del self.space.constraints.check # it's a family
variable = self.objectspace.paths.get_family_obj(target.name)
return variable, list(variable.variable.values())
def check_params_target(self):
for condition in self.objectspace.space.constraints.condition:
for param in condition.param:
if param.type not in TYPE_PARAM_CONDITION:
raise DictConsistencyError(_(f'cannot use {param.type} type as a param in a condition'))
if not hasattr(condition, 'target'):
raise DictConsistencyError(_('target is mandatory in condition'))
for target in condition.target:
if target.type.endswith('list') and condition.name not in ['disabled_if_in', 'disabled_if_not_in']:
raise DictConsistencyError(_(f'target in condition for {target.type} not allow in {condition.name}'))
def filter_targets(self): # pylint: disable=C0111
for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition):
namespace = condition.namespace
for idx, target in enumerate(condition.target):
if target.type == 'variable':
if condition.source == target.name:
raise DictConsistencyError(_('target name and source name must be different: {}').format(condition.source))
try:
target.name = self.objectspace.paths.get_variable_path(target.name, namespace)
except DictConsistencyError:
# for optional variable
pass
elif target.type == 'family':
try:
target.name = self.objectspace.paths.get_family_path(target.name, namespace)
except KeyError:
raise DictConsistencyError(_('cannot found family {}').format(target.name))
def convert_xxxlist_to_variable(self): # pylint: disable=C0111
# transform *list to variable or family
for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition):
new_targets = []
remove_targets = []
for target_idx, target in enumerate(condition.target):
if target.type.endswith('list'):
listname = target.type
listvars = self.objectspace.list_conditions.get(listname,
{}).get(target.name)
if listvars:
for listvar in listvars:
variable = self.objectspace.paths.get_variable_obj(listvar)
type_ = 'variable'
new_target = self.objectspace.target()
new_target.type = type_
new_target.name = listvar
new_target.index = target.index
new_targets.append(new_target)
remove_targets.append(target_idx)
remove_targets.sort(reverse=True)
for target_idx in remove_targets:
condition.target.pop(target_idx)
condition.target.extend(new_targets)
def check_condition_fallback_optional(self):
# a condition with a fallback **and** the source variable doesn't exist
remove_conditions = []
for idx, condition in enumerate(self.objectspace.space.constraints.condition):
# fallback
if condition.fallback is True and not self.objectspace.paths.path_is_defined(condition.source):
apply_action = False
if condition.name in ['disabled_if_in', 'mandatory_if_in', 'hidden_if_in']:
apply_action = not condition.force_condition_on_fallback
else:
apply_action = condition.force_inverse_condition_on_fallback
if apply_action:
actions = self._get_condition_actions(condition.name)
for target in condition.target:
leader_or_variable, variables = self._get_family_variables_from_target(target)
for action_idx, action in enumerate(actions):
if action_idx == 0:
setattr(leader_or_variable, action, True)
else:
for variable in variables:
setattr(variable, action, True)
remove_conditions.append(idx)
continue
remove_targets = []
# optional
for idx, target in enumerate(condition.target):
if target.optional is True and not self.objectspace.paths.path_is_defined(target.name):
remove_targets.append(idx)
remove_targets = list(set(remove_targets))
remove_targets.sort(reverse=True)
for idx in remove_targets:
condition.target.pop(idx)
remove_conditions = list(set(remove_conditions))
remove_conditions.sort(reverse=True)
for idx in remove_conditions:
self.objectspace.space.constraints.condition.pop(idx)
def _get_condition_actions(self, condition_name):
if condition_name.startswith('disabled_if_'):
return ['disabled']
elif condition_name.startswith('hidden_if_'):
return ['hidden', 'frozen', 'force_default_on_freeze']
elif condition_name.startswith('mandatory_if_'):
return ['mandatory']
elif condition_name == 'auto_hidden_if_not_in':
return ['auto_frozen']
def check_choice_option_condition(self):
# remove condition for ChoiceOption that don't have param
remove_conditions = []
for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition):
namespace = condition.namespace
condition.source = self.objectspace.paths.get_variable_path(condition.source, namespace, allow_source=True)
src_variable = self.objectspace.paths.get_variable_obj(condition.source)
valid_enum = None
if condition.source in self.valid_enums and self.valid_enums[condition.source]['type'] == 'string':
valid_enum = self.valid_enums[condition.source]['values']
if valid_enum is not None:
remove_param = []
for param_idx, param in enumerate(condition.param):
if param.text not in valid_enum:
remove_param.append(param_idx)
remove_param.sort(reverse=True)
for idx in remove_param:
del condition.param[idx]
if condition.param == []:
remove_targets = []
for target in condition.target:
leader_or_variable, variables = self._get_family_variables_from_target(target)
if condition.name == 'disabled_if_not_in':
leader_or_variable.disabled = True
elif condition.name == 'hidden_if_not_in':
leader_or_variable.hidden = True
for variable in variables:
variable.frozen = True
variable.force_default_on_freeze = True
elif condition.name == 'mandatory_if_not_in':
variable.mandatory = True
remove_targets = list(set(remove_targets))
remove_targets.sort(reverse=True)
for target_idx in remove_targets:
condition.target.pop(target_idx)
remove_conditions.append(condition_idx)
remove_conditions = list(set(remove_conditions))
remove_conditions.sort(reverse=True)
for idx in remove_conditions:
self.objectspace.space.constraints.condition.pop(idx)
def remove_condition_with_empty_target(self):
remove_conditions = []
for condition_idx, condition in enumerate(self.objectspace.space.constraints.condition):
if not condition.target:
remove_conditions.append(condition_idx)
remove_conditions = list(set(remove_conditions))
remove_conditions.sort(reverse=True)
for idx in remove_conditions:
self.objectspace.space.constraints.condition.pop(idx)
def convert_condition(self):
for condition in self.objectspace.space.constraints.condition:
inverse = condition.name.endswith('_if_not_in')
actions = self._get_condition_actions(condition.name)
for param in condition.param:
if hasattr(param, 'text'):
param = param.text
else:
param = None
for target in condition.target:
leader_or_variable, variables = self._get_family_variables_from_target(target)
# if option is already disable, do not apply disable_if_in
if hasattr(leader_or_variable, actions[0]) and getattr(leader_or_variable, actions[0]) is True:
continue
for idx, action in enumerate(actions):
prop = self.objectspace.property_()
prop.type = 'calculation'
prop.inverse = inverse
prop.source = condition.source
prop.expected = param
prop.name = action
if idx == 0:
if not hasattr(leader_or_variable, 'property'):
leader_or_variable.property = []
leader_or_variable.property.append(prop)
else:
for variable in variables:
if not hasattr(variable, 'property'):
variable.property = []
variable.property.append(prop)
del self.objectspace.space.constraints.condition
def _set_valid_enum(self, variable, values, type_):
# value for choice's variable is mandatory
variable.mandatory = True
# build choice
variable.choice = []
choices = []
for value in values:
choice = self.objectspace.choice()
try:
choice.name = CONVERSION.get(type_, str)(value)
except:
raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{value}" is not a valid "{type_}" for "{variable.name}"'))
choices.append(choice.name)
choice.type = type_
variable.choice.append(choice)
if not variable.choice:
raise DictConsistencyError(_('empty valid enum is not allowed for variable {}').format(variable.name))
# check value or set first choice value has default value
if hasattr(variable, 'value'):
for value in variable.value:
value.type = type_
try:
cvalue = CONVERSION.get(type_, str)(value.name)
except:
raise DictConsistencyError(_(f'unable to change type of value "{value}" is not a valid "{type_}" for "{variable.name}"'))
if cvalue not in choices:
raise DictConsistencyError(_('value "{}" of variable "{}" is not in list of all expected values ({})').format(value.name, variable.name, choices))
else:
new_value = self.objectspace.value()
new_value.name = values[0]
new_value.type = type_
variable.value = [new_value]
variable.type = 'choice'
def convert_check(self): def convert_check(self):
if not hasattr(self.space, 'constraints') or not hasattr(self.space.constraints, 'check'): for check in self.objectspace.space.constraints.check:
return variable = self.objectspace.paths.get_variable_obj(check.target)
for check in self.space.constraints.check:
variable = self.paths.get_variable_obj(check.target)
check_ = self.objectspace.check() check_ = self.objectspace.check()
name = check.name name = check.name
if name == 'valid_differ': if name == 'valid_differ':
@ -912,239 +947,168 @@ class SpaceAnnotator(object):
if not hasattr(variable, 'check'): if not hasattr(variable, 'check'):
variable.check = [] variable.check = []
variable.check.append(check_) variable.check.append(check_)
del self.space.constraints.check del self.objectspace.space.constraints.check
def filter_targets(self): # pylint: disable=C0111 def convert_fill(self): # pylint: disable=C0111,R0912
for condition_idx, condition in enumerate(self.space.constraints.condition): # sort fill/auto by index
namespace = condition.namespace fills = {fill.index: fill for idx, fill in enumerate(self.objectspace.space.constraints.fill)}
for idx, target in enumerate(condition.target): indexes = list(fills.keys())
if target.type == 'variable': indexes.sort()
if condition.source == target.name: targets = []
raise DictConsistencyError(_('target name and source name must be different: {}').format(condition.source)) eosfunc = dir(self.eosfunc)
target.name = self.paths.get_variable_path(target.name, namespace) for idx in indexes:
elif target.type == 'family': fill = fills[idx]
# test if it's redefined calculation
if fill.target in targets and not fill.redefine:
raise DictConsistencyError(_(f"A fill already exists for the target: {fill.target}"))
targets.append(fill.target)
#
if fill.name not in eosfunc:
raise DictConsistencyError(_('cannot find fill function {}').format(fill.name))
namespace = fill.namespace
# let's replace the target by the path
fill.target = self.objectspace.paths.get_variable_path(fill.target,
namespace,
)
value = self.objectspace.value()
value.type = 'calculation'
value.name = fill.name
if hasattr(fill, 'param'):
param_to_delete = []
for fill_idx, param in enumerate(fill.param):
if param.type not in TYPE_PARAM_FILL:
raise DictConsistencyError(_(f'cannot use {param.type} type as a param in a fill/auto'))
if param.type != 'string' and not hasattr(param, 'text'):
raise DictConsistencyError(_(f"All '{param.type}' variables shall have a value in order to calculate {fill.target}"))
if param.type == 'variable':
try: try:
target.name = self.paths.get_family_path(target.name, namespace) param.text, suffix = self.objectspace.paths.get_variable_path(param.text,
except KeyError: namespace,
raise DictConsistencyError(_('cannot found family {}').format(target.name)) with_suffix=True,
)
def convert_xxxlist_to_variable(self): # pylint: disable=C0111 if suffix:
# transform *list to variable or family param.suffix = suffix
for condition_idx, condition in enumerate(self.space.constraints.condition): except DictConsistencyError as err:
new_targets = [] if param.optional is False:
remove_targets = [] raise err
for target_idx, target in enumerate(condition.target): param_to_delete.append(fill_idx)
if target.type not in ['variable', 'family']: continue
listname = target.type
if not listname.endswith('list'):
raise Exception('not yet implemented')
listvars = self.objectspace.list_conditions.get(listname,
{}).get(target.name)
if listvars:
for listvar in listvars:
variable = self.paths.get_variable_obj(listvar)
type_ = 'variable'
new_target = self.objectspace.target()
new_target.type = type_
new_target.name = listvar
new_target.index = target.index
new_targets.append(new_target)
remove_targets.append(target_idx)
remove_targets = list(set(remove_targets))
remove_targets.sort(reverse=True)
for target_idx in remove_targets:
condition.target.pop(target_idx)
condition.target.extend(new_targets)
def check_condition(self):
for condition in self.space.constraints.condition:
if condition.name not in ['disabled_if_in', 'disabled_if_not_in', 'hidden_if_in', 'auto_hidden_if_not_in',
'hidden_if_not_in', 'mandatory_if_in', 'mandatory_if_not_in']:
raise DictConsistencyError(_(f'unknown condition {condition.name}'))
def check_params(self):
for condition in self.space.constraints.condition:
for param in condition.param:
if param.type not in TYPE_PARAM_CONDITION:
raise DictConsistencyError(_(f'cannot use {param.type} type as a param in a condition'))
def check_target(self):
for condition in self.space.constraints.condition:
if not hasattr(condition, 'target'):
raise DictConsistencyError(_('target is mandatory in condition'))
for target in condition.target:
if target.type.endswith('list') and condition.name not in ['disabled_if_in', 'disabled_if_not_in']:
raise DictConsistencyError(_(f'target in condition for {target.type} not allow in {condition.name}'))
def check_condition_fallback_optional(self):
# a condition with a fallback **and** the source variable doesn't exist
remove_conditions = []
for idx, condition in enumerate(self.space.constraints.condition):
remove_targets = []
if condition.fallback is True and not self.paths.path_is_defined(condition.source):
for target in condition.target:
if target.type in ['variable', 'family']:
if target.name.startswith(variable_namespace + '.'):
name = target.name.split('.')[-1]
else: else:
name = target.name param.notraisepropertyerror = None
if target.type == 'variable': param_to_delete.sort(reverse=True)
variable = self.paths.get_variable_obj(name) for param_idx in param_to_delete:
else: fill.param.pop(param_idx)
variable = self.paths.get_family_obj(name) value.param = fill.param
if condition.name == 'disabled_if_in': variable = self.objectspace.paths.get_variable_obj(fill.target)
variable.disabled = True variable.value = [value]
if condition.name == 'mandatory_if_in': del self.objectspace.space.constraints.fill
variable.mandatory = True
if condition.name == 'hidden_if_in':
variable.hidden = True
else:
listname = target.type
listvars = self.objectspace.list_conditions.get(listname,
{}).get(target.name, None)
if listvars is not None:
for listvar in listvars:
variable = self.paths.get_variable_obj(listvar)
if condition.name in ['disabled_if_in']:
variable.value[0].name = False
del self.objectspace.list_conditions[listname][target.name]
remove_conditions.append(idx)
for idx, target in enumerate(condition.target):
if target.optional is True and not self.paths.path_is_defined(target.name):
remove_targets.append(idx)
remove_targets = list(set(remove_targets))
remove_targets.sort(reverse=True)
for idx in remove_targets:
condition.target.pop(idx)
remove_conditions = list(set(remove_conditions))
remove_conditions.sort(reverse=True)
for idx in remove_conditions:
self.space.constraints.condition.pop(idx)
def check_choice_option_condition(self): def remove_constraints(self):
# remove condition for ChoiceOption that don't have param if hasattr(self.objectspace.space.constraints, 'index'):
remove_conditions = [] del self.objectspace.space.constraints.index
for condition_idx, condition in enumerate(self.space.constraints.condition): del self.objectspace.space.constraints.namespace
namespace = condition.namespace if vars(self.objectspace.space.constraints):
src_variable = self.paths.get_variable_obj(condition.source) raise Exception('constraints again?')
condition.source = self.paths.get_variable_path(condition.source, namespace, allow_source=True) del self.objectspace.space.constraints
valid_enum = None
if condition.source in self.valid_enums and \
self.valid_enums[condition.source]['type'] == 'string':
valid_enum = self.valid_enums[condition.source]['values']
if src_variable.type in FORCE_CHOICE:
valid_enum = FORCE_CHOICE[src_variable.type]
if valid_enum is not None:
remove_param = []
for param_idx, param in enumerate(condition.param):
if param.text not in valid_enum:
remove_param.append(param_idx)
remove_param.sort(reverse=True)
for idx in remove_param:
del condition.param[idx]
if condition.param == []:
remove_targets = []
for target in condition.target:
if target.name.startswith(f'{variable_namespace}.'):
name = target.name.split('.')[-1]
else:
name = target.name
if target.type == 'variable':
variable = self.paths.get_variable_obj(name)
else:
variable = self.paths.get_family_obj(name)
if condition.name == 'disabled_if_not_in':
variable.disabled = True
elif condition.name == 'hidden_if_not_in':
variable.hidden = True
elif condition.name == 'mandatory_if_not_in':
variable.mandatory = True
remove_targets = list(set(remove_targets))
remove_targets.sort(reverse=True)
for target_idx in remove_targets:
condition.target.pop(target_idx)
remove_conditions.append(condition_idx)
remove_conditions = list(set(remove_conditions))
remove_conditions.sort(reverse=True)
for idx in remove_conditions:
self.space.constraints.condition.pop(idx)
def manage_variable_property(self):
for condition in self.space.constraints.condition:
#parse each variable and family
for target_idx, target in enumerate(condition.target):
if target.name.startswith(f'{variable_namespace}.'):
name = target.name.split('.')[-1]
else:
name = target.name
if target.type == 'variable':
variable = self.paths.get_variable_obj(name)
else:
variable = self.paths.get_family_obj(name)
if condition.name in ['hidden_if_in', 'hidden_if_not_in']:
variable.hidden = False
if condition.name in ['mandatory_if_in', 'mandatory_if_not_in']:
variable.mandatory = False
if HIGH_COMPATIBILITY and condition.name in ['hidden_if_in',
'hidden_if_not_in']:
self.has_hidden_if_in_condition.append(name)
if condition.name in ['mandatory_if_in', 'mandatory_if_not_in']:
self.force_not_mandatory.append(target.name)
def remove_condition_with_empty_target(self): class FamilyAnnotator:
remove_conditions = [] def __init__(self, objectspace, force_not_mandatory):
for condition_idx, condition in enumerate(self.space.constraints.condition): self.objectspace = objectspace
if not condition.target: self.force_not_mandatory = force_not_mandatory
remove_conditions.append(condition_idx) self.remove_empty_families()
remove_conditions = list(set(remove_conditions)) self.change_variable_mode()
remove_conditions.sort(reverse=True) self.change_family_mode()
for idx in remove_conditions: self.dynamic_families()
self.space.constraints.condition.pop(idx)
def filter_condition(self): # pylint: disable=C0111 def remove_empty_families(self): # pylint: disable=C0111,R0201
if not hasattr(self.space, 'constraints') or not hasattr(self.space.constraints, 'condition'): if hasattr(self.objectspace.space, 'variables'):
for family in self.objectspace.space.variables.values():
if hasattr(family, 'family'):
space = family.family
removed_families = []
for family_name, family in space.items():
if not hasattr(family, 'variable') or len(family.variable) == 0:
removed_families.append(family_name)
del space[family_name]
def change_family_mode(self): # pylint: disable=C0111
if not hasattr(self.objectspace.space, 'variables'):
return return
self.check_condition() for family in self.objectspace.space.variables.values():
self.check_params() if hasattr(family, 'family'):
self.check_target() for family in family.family.values():
self.check_condition_fallback_optional() mode = modes_level[-1]
self.filter_targets() for variable in family.variable.values():
self.convert_xxxlist_to_variable() if isinstance(variable, self.objectspace.Leadership):
self.check_choice_option_condition() variable_mode = variable.variable[0].mode
self.manage_variable_property() variable.variable[0].mode = None
self.remove_condition_with_empty_target() variable.mode = variable_mode
for condition in self.space.constraints.condition:
inverse = condition.name.endswith('_if_not_in')
if condition.name.startswith('disabled_if_'):
actions = ['disabled']
elif condition.name.startswith('hidden_if_'):
actions = ['frozen', 'hidden', 'force_default_on_freeze']
elif condition.name.startswith('mandatory_if_'):
actions = ['mandatory']
elif condition.name == 'auto_hidden_if_not_in':
actions = ['auto_frozen']
for param in condition.param:
if hasattr(param, 'text'):
param = param.text
else: else:
param = None variable_mode = variable.mode
for target in condition.target: if variable_mode is not None and modes[mode] > modes[variable_mode]:
if target.name.startswith(f'{variable_namespace}.'): mode = variable_mode
name = target.name.split('.')[-1] family.mode = mode
def dynamic_families(self): # pylint: disable=C0111
if not hasattr(self.objectspace.space, 'variables'):
return
for family in self.objectspace.space.variables.values():
if hasattr(family, 'family'):
for family in family.family.values():
if 'dynamic' in vars(family):
namespace = self.objectspace.paths.get_variable_namespace(family.dynamic)
varpath = self.objectspace.paths.get_variable_path(family.dynamic, namespace)
family.dynamic = varpath
def annotate_variable(self, variable, family_mode, path, is_follower=False):
# if the variable is mandatory and doesn't have any value
# then the variable's mode is set to 'basic'
has_value = hasattr(variable, 'value')
if variable.mandatory is True and (not has_value or is_follower):
variable.mode = modes_level[0]
if variable.mode != None and modes[variable.mode] < modes[family_mode] and (not is_follower or variable.mode != modes_level[0]):
variable.mode = family_mode
if has_value and path not in self.force_not_mandatory:
variable.mandatory = True
if variable.hidden is True:
variable.frozen = True
if not variable.auto_save is True and 'force_default_on_freeze' not in vars(variable):
variable.force_default_on_freeze = True
def change_variable_mode(self): # pylint: disable=C0111
if not hasattr(self.objectspace.space, 'variables'):
return
for variables in self.objectspace.space.variables.values():
namespace = variables.name
if hasattr(variables, 'family'):
for family in variables.family.values():
family_mode = family.mode
if hasattr(family, 'variable'):
for variable in family.variable.values():
if isinstance(variable, self.objectspace.Leadership):
mode = modes_level[-1]
for idx, follower in enumerate(variable.variable):
if follower.auto_save is True:
raise DictConsistencyError(_(f'leader/followers {follower.name} could not be auto_save'))
if follower.auto_freeze is True:
raise DictConsistencyError(_('leader/followers {follower.name} could not be auto_freeze'))
is_follower = idx != 0
path = '{}.{}.{}'.format(family.path, variable.name, follower.name)
self.annotate_variable(follower, family_mode, path, is_follower)
# leader's mode is minimum level
if modes[variable.variable[0].mode] > modes[follower.mode]:
follower.mode = variable.variable[0].mode
variable.mode = variable.variable[0].mode
else: else:
name = target.name # auto_save's variable is set in 'basic' mode if its mode is 'normal'
if target.type == 'variable': if variable.auto_save is True and variable.mode != modes_level[-1]:
variable = self.paths.get_variable_obj(name) variable.mode = modes_level[0]
else: # auto_freeze's variable is set in 'basic' mode if its mode is 'normal'
variable = self.paths.get_family_obj(name) if variable.auto_freeze is True and variable.mode != modes_level[-1]:
if not hasattr(variable, 'property'): variable.mode = modes_level[0]
variable.property = [] path = '{}.{}'.format(family.path, variable.name)
for action in actions: self.annotate_variable(variable, family_mode, path)
prop = self.objectspace.property_()
prop.type = 'calculation'
prop.inverse = inverse
prop.source = condition.source
prop.expected = param
prop.name = action
variable.property.append(prop)
del self.space.constraints.condition

View File

@ -129,9 +129,11 @@
<!ATTLIST check level (error|warning) "error"> <!ATTLIST check level (error|warning) "error">
<!ELEMENT condition ((target | param)+ )> <!ELEMENT condition ((target | param)+ )>
<!ATTLIST condition name CDATA #REQUIRED> <!ATTLIST condition name (disabled_if_in|disabled_if_not_in|hidden_if_in|auto_hidden_if_not_in|hidden_if_not_in|mandatory_if_in|mandatory_if_not_in) #REQUIRED>
<!ATTLIST condition source CDATA #REQUIRED> <!ATTLIST condition source CDATA #REQUIRED>
<!ATTLIST condition fallback (True|False) "False"> <!ATTLIST condition fallback (True|False) "False">
<!ATTLIST condition force_condition_on_fallback (True|False) "False">
<!ATTLIST condition force_inverse_condition_on_fallback (True|False) "False">
<!ELEMENT group (follower+)> <!ELEMENT group (follower+)>
<!ATTLIST group leader CDATA #REQUIRED> <!ATTLIST group leader CDATA #REQUIRED>

View File

@ -27,8 +27,8 @@ from collections import OrderedDict
from lxml.etree import Element, SubElement # pylint: disable=E0611 from lxml.etree import Element, SubElement # pylint: disable=E0611
from .i18n import _ from .i18n import _
from .xmlreflector import XMLReflector, HIGH_COMPATIBILITY from .xmlreflector import XMLReflector
from .annotator import ERASED_ATTRIBUTES, ServiceAnnotator, SpaceAnnotator from .annotator import ERASED_ATTRIBUTES, SpaceAnnotator
from .utils import normalize_family from .utils import normalize_family
from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyError from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyError
from .path import Path from .path import Path
@ -183,7 +183,7 @@ class CreoleObjSpace:
family_names.append(child.attrib['name']) family_names.append(child.attrib['name'])
if child.tag == 'variables': if child.tag == 'variables':
child.attrib['name'] = namespace child.attrib['name'] = namespace
if HIGH_COMPATIBILITY and child.tag == 'value' and child.text == None: if child.tag == 'value' and child.text == None:
# FIXME should not be here # FIXME should not be here
continue continue
# variable objects creation # variable objects creation
@ -444,8 +444,6 @@ class CreoleObjSpace:
): ):
redefine = self.convert_boolean(child.attrib.get('redefine', False)) redefine = self.convert_boolean(child.attrib.get('redefine', False))
has_value = hasattr(variableobj, 'value') has_value = hasattr(variableobj, 'value')
if HIGH_COMPATIBILITY and has_value:
has_value = len(child) != 1 or child[0].text != None
if redefine is True and child.tag == 'variable' and has_value and len(child) != 0: if redefine is True and child.tag == 'variable' and has_value and len(child) != 0:
del variableobj.value del variableobj.value
for attr, val in child.attrib.items(): for attr, val in child.attrib.items():
@ -522,7 +520,6 @@ class CreoleObjSpace:
variableobj.path = self.paths.get_family_path(family_name, namespace) variableobj.path = self.paths.get_family_path(family_name, namespace)
def space_visitor(self, eosfunc_file): # pylint: disable=C0111 def space_visitor(self, eosfunc_file): # pylint: disable=C0111
ServiceAnnotator(self)
SpaceAnnotator(self, eosfunc_file) SpaceAnnotator(self, eosfunc_file)
def save(self, filename, force_no_save=False): def save(self, filename, force_no_save=False):

View File

@ -13,6 +13,7 @@ class Path:
def __init__(self): def __init__(self):
self.variables = {} self.variables = {}
self.families = {} self.families = {}
self.full_paths = {}
# Family # Family
def add_family(self, def add_family(self,
@ -20,7 +21,12 @@ class Path:
name: str, name: str,
variableobj: str, variableobj: str,
) -> str: # pylint: disable=C0111 ) -> str: # pylint: disable=C0111
self.families[name] = dict(name=name, if '.' not in name and namespace == variable_namespace:
full_name = '.'.join([namespace, name])
self.full_paths[name] = full_name
else:
full_name = name
self.families[full_name] = dict(name=name,
namespace=namespace, namespace=namespace,
variableobj=variableobj, variableobj=variableobj,
) )
@ -29,24 +35,26 @@ class Path:
name: str, name: str,
current_namespace: str, current_namespace: str,
) -> str: # pylint: disable=C0111 ) -> str: # pylint: disable=C0111
if current_namespace is None: # pragma: no cover name = normalize_family(name,
raise OperationError('current_namespace must not be None')
dico = self.families[normalize_family(name,
check_name=False, check_name=False,
allow_dot=True, allow_dot=True,
)] )
if '.' not in name and current_namespace == variable_namespace and name in self.full_paths:
name = self.full_paths[name]
if current_namespace is None: # pragma: no cover
raise OperationError('current_namespace must not be None')
dico = self.families[name]
if dico['namespace'] != variable_namespace and current_namespace != dico['namespace']: if dico['namespace'] != variable_namespace and current_namespace != dico['namespace']:
raise DictConsistencyError(_('A family located in the {} namespace ' raise DictConsistencyError(_('A family located in the {} namespace '
'shall not be used in the {} namespace').format( 'shall not be used in the {} namespace').format(
dico['namespace'], current_namespace)) dico['namespace'], current_namespace))
path = dico['name'] return dico['name']
if dico['namespace'] is not None and '.' not in dico['name']:
path = '.'.join([dico['namespace'], path])
return path
def get_family_obj(self, def get_family_obj(self,
name: str, name: str,
) -> 'Family': # pylint: disable=C0111 ) -> 'Family': # pylint: disable=C0111
if '.' not in name and name in self.full_paths:
name = self.full_paths[name]
if name not in self.families: if name not in self.families:
raise DictConsistencyError(_('unknown family {}').format(name)) raise DictConsistencyError(_('unknown family {}').format(name))
dico = self.families[name] dico = self.families[name]
@ -59,7 +67,6 @@ class Path:
name: str, name: str,
leader_name: str, leader_name: str,
) -> None: # pylint: disable=C0111 ) -> None: # pylint: disable=C0111
if namespace != variable_namespace:
# need rebuild path and move object in new path # need rebuild path and move object in new path
old_path = namespace + '.' + leader_family_name + '.' + name old_path = namespace + '.' + leader_family_name + '.' + name
dico = self._get_variable(old_path) dico = self._get_variable(old_path)
@ -71,6 +78,9 @@ class Path:
False, False,
dico['variableobj'], dico['variableobj'],
) )
if namespace == variable_namespace:
self.full_paths[name] = new_path
else:
name = new_path name = new_path
dico = self._get_variable(name) dico = self._get_variable(name)
if dico['leader'] != None: if dico['leader'] != None:
@ -89,11 +99,14 @@ class Path:
is_dynamic: bool, is_dynamic: bool,
variableobj, variableobj,
) -> str: # pylint: disable=C0111 ) -> str: # pylint: disable=C0111
if namespace == variable_namespace or '.' in name: if '.' not in name:
varname = name full_name = '.'.join([namespace, family, name])
self.full_paths[name] = full_name
else: else:
varname = '.'.join([namespace, family, name]) full_name = name
self.variables[varname] = dict(name=name, if namespace == variable_namespace:
name = name.rsplit('.', 1)[1]
self.variables[full_name] = dict(name=name,
family=family, family=family,
namespace=namespace, namespace=namespace,
leader=None, leader=None,
@ -154,6 +167,8 @@ class Path:
def path_is_defined(self, def path_is_defined(self,
name: str, name: str,
) -> str: # pylint: disable=C0111 ) -> str: # pylint: disable=C0111
if '.' not in name and name not in self.variables and name in self.full_paths:
return True
return name in self.variables return name in self.variables
def _get_variable(self, def _get_variable(self,
@ -161,14 +176,20 @@ class Path:
with_suffix: bool=False, with_suffix: bool=False,
) -> str: ) -> str:
if name not in self.variables: if name not in self.variables:
if name.startswith(f'{variable_namespace}.'): if name not in self.variables:
name = name.split('.')[-1] if '.' not in name and name in self.full_paths:
name = self.full_paths[name]
if name not in self.variables: if name not in self.variables:
for var_name, variable in self.variables.items(): for var_name, variable in self.variables.items():
if variable['is_dynamic'] and name.startswith(var_name): if variable['is_dynamic'] and name.startswith(var_name):
return variable, name[len(var_name):] return variable, name[len(var_name):]
if '.' not in name:
for var_name, path in self.full_paths.items():
if name.startswith(var_name):
variable = self.variables[self.full_paths[var_name]]
if variable['is_dynamic']:
return variable, name[len(var_name):]
raise DictConsistencyError(_('unknown option {}').format(name)) raise DictConsistencyError(_('unknown option {}').format(name))
if with_suffix: if with_suffix:
return self.variables[name], None return self.variables[name], None
return self.variables[name] return self.variables[name]

View File

@ -8,7 +8,6 @@ from lxml.etree import DTD, parse, tostring # , XMLParser
from .i18n import _ from .i18n import _
from .error import DictConsistencyError from .error import DictConsistencyError
HIGH_COMPATIBILITY = True
class XMLReflector(object): class XMLReflector(object):
"""Helper class for loading the Creole XML file, """Helper class for loading the Creole XML file,

View File

@ -8,7 +8,7 @@
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True"> <variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
<value>non</value> <value>non</value>
</variable> </variable>
<variable name="autosavevar" type="string" description="autosave variable" hidden="True" auto_save="True"/> <variable name="autosavevar" type="string" description="autosave variable" auto_save="True"/>
</family> </family>
<separators/> <separators/>
</variables> </variables>

View File

@ -17,8 +17,8 @@
<property>force_store_value</property> <property>force_store_value</property>
<property>mandatory</property> <property>mandatory</property>
<property>basic</property> <property>basic</property>
<property expected="oui" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">hidden</property> <property expected="oui" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">hidden</property>
<property expected="oui" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">force_default_on_freeze</property> <property expected="oui" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">force_default_on_freeze</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param type="string">oui</param> <param type="string">oui</param>

View File

@ -3,7 +3,7 @@ from rougail.tiramisu import ConvertDynOptionDescription
import imp import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py') func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal']), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non')) option_3 = ChoiceOption(properties=frozenset(['force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal']), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_4 = StrOption(properties=frozenset(['force_store_value', 'mandatory', 'basic', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='autosave variable', multi=False, name='autosavevar', default=Calculation(func.calc_val, Params((ParamValue("oui")), kwargs={}))) option_4 = StrOption(properties=frozenset(['force_store_value', 'mandatory', 'basic', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='autosave variable', multi=False, name='autosavevar', default=Calculation(func.calc_val, Params((ParamValue("oui")), kwargs={})))
option_2 = OptionDescription(doc='général', name='general', properties=frozenset(['basic']), children=[option_3, option_4]) option_2 = OptionDescription(doc='général', name='general', properties=frozenset(['basic']), children=[option_3, option_4])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2]) option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -9,8 +9,8 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<family name="leadermode" mode="expert"> <family name="leadermode">
<variable name="leader" type="string" description="leader" multi="True" hidden="True"/> <variable name="leader" type="string" description="leader" multi="True" mode="expert"/>
<variable name="follower1" type="string" description="follower1"/> <variable name="follower1" type="string" description="follower1"/>
<variable name="follower2" type="string" description="follower2"/> <variable name="follower2" type="string" description="follower2"/>
</family> </family>

View File

@ -14,24 +14,17 @@
<family doc="leadermode" name="leadermode"> <family doc="leadermode" name="leadermode">
<property>expert</property> <property>expert</property>
<leader doc="leader" name="leader"> <leader doc="leader" name="leader">
<property>hidden</property>
<property>expert</property> <property>expert</property>
<variable doc="leader" multi="True" name="leader" type="string"> <variable doc="leader" multi="True" name="leader" type="string">
<property>force_default_on_freeze</property>
<property>frozen</property>
<property>mandatory</property> <property>mandatory</property>
<value name="calc_list" type="calculation"> <value name="calc_list" type="calculation">
<param name="valeur" type="string">valfill</param> <param name="valeur" type="string">valfill</param>
</value> </value>
</variable> </variable>
<variable doc="follower1" multi="False" name="follower1" type="string"> <variable doc="follower1" multi="False" name="follower1" type="string">
<property>force_default_on_freeze</property>
<property>frozen</property>
<property>expert</property> <property>expert</property>
</variable> </variable>
<variable doc="follower2" multi="False" name="follower2" type="string"> <variable doc="follower2" multi="False" name="follower2" type="string">
<property>force_default_on_freeze</property>
<property>frozen</property>
<property>expert</property> <property>expert</property>
</variable> </variable>
</leader> </leader>

View File

@ -4,10 +4,10 @@ import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py') func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'expert']), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non')) option_3 = ChoiceOption(properties=frozenset(['mandatory', 'expert']), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['expert']), children=[option_3]) option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['expert']), children=[option_3])
option_6 = StrOption(properties=frozenset(['force_default_on_freeze', 'frozen', 'mandatory']), doc='leader', multi=True, name='leader', default=Calculation(func.calc_list, Params((), kwargs={'valeur': ParamValue("valfill")}))) option_6 = StrOption(properties=frozenset(['mandatory']), doc='leader', multi=True, name='leader', default=Calculation(func.calc_list, Params((), kwargs={'valeur': ParamValue("valfill")})))
option_7 = StrOption(properties=frozenset(['force_default_on_freeze', 'frozen', 'expert']), doc='follower1', multi=True, name='follower1') option_7 = StrOption(properties=frozenset(['expert']), doc='follower1', multi=True, name='follower1')
option_8 = StrOption(properties=frozenset(['force_default_on_freeze', 'frozen', 'expert']), doc='follower2', multi=True, name='follower2') option_8 = StrOption(properties=frozenset(['expert']), doc='follower2', multi=True, name='follower2')
option_5 = Leadership(doc='leader', name='leader', properties=frozenset(['hidden', 'expert']), children=[option_6, option_7, option_8]) option_5 = Leadership(doc='leader', name='leader', properties=frozenset(['expert']), children=[option_6, option_7, option_8])
option_4 = OptionDescription(doc='leadermode', name='leadermode', properties=frozenset(['expert']), children=[option_5]) option_4 = OptionDescription(doc='leadermode', name='leadermode', properties=frozenset(['expert']), children=[option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2, option_4]) option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2, option_4])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -0,0 +1,31 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="general" mode="expert">
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<family name="leadermode">
<variable name="leader" type="string" description="leader" multi="True" hidden="True"/>
<variable name="follower1" type="string" description="follower1"/>
<variable name="follower2" type="string" description="follower2"/>
</family>
</variables>
<constraints>
<fill name="calc_list" target="leader">
<param name="valeur">valfill</param>
</fill>
<group leader="leader">
<follower>follower1</follower>
<follower>follower2</follower>
</group>
</constraints>
<help/>
</rougail>

View File

@ -0,0 +1 @@
{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": [], "rougail.leadermode.leader.follower1": [], "rougail.leadermode.leader.follower2": []}

View File

@ -0,0 +1,40 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<family doc="rougail" name="rougail">
<family doc="general" name="general">
<property>expert</property>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>expert</property>
<value type="string">non</value>
</variable>
</family>
<family doc="leadermode" name="leadermode">
<property>normal</property>
<leader doc="leader" name="leader">
<property>hidden</property>
<property>normal</property>
<variable doc="leader" multi="True" name="leader" type="string">
<property>force_default_on_freeze</property>
<property>frozen</property>
<property>mandatory</property>
<value name="calc_list" type="calculation">
<param name="valeur" type="string">valfill</param>
</value>
</variable>
<variable doc="follower1" multi="False" name="follower1" type="string">
<property>force_default_on_freeze</property>
<property>frozen</property>
<property>normal</property>
</variable>
<variable doc="follower2" multi="False" name="follower2" type="string">
<property>force_default_on_freeze</property>
<property>frozen</property>
<property>normal</property>
</variable>
</leader>
</family>
</family>
</rougail>

View File

@ -0,0 +1,13 @@
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'expert']), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['expert']), children=[option_3])
option_6 = StrOption(properties=frozenset(['force_default_on_freeze', 'frozen', 'mandatory']), doc='leader', multi=True, name='leader', default=Calculation(func.calc_list, Params((), kwargs={'valeur': ParamValue("valfill")})))
option_7 = StrOption(properties=frozenset(['force_default_on_freeze', 'frozen', 'normal']), doc='follower1', multi=True, name='follower1')
option_8 = StrOption(properties=frozenset(['force_default_on_freeze', 'frozen', 'normal']), doc='follower2', multi=True, name='follower2')
option_5 = Leadership(doc='leader', name='leader', properties=frozenset(['hidden', 'normal']), children=[option_6, option_7, option_8])
option_4 = OptionDescription(doc='leadermode', name='leadermode', properties=frozenset(['normal']), children=[option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2, option_4])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -0,0 +1,32 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="general" mode="expert">
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<family name="leadermode">
<variable name="leader" type="string" description="leader" multi="True"/>
<variable name="follower1" type="string" description="follower1"/>
<variable name="follower2" type="string" description="follower2"/>
</family>
</variables>
<constraints>
<group leader="leader">
<follower>follower1</follower>
<follower>follower2</follower>
</group>
<condition name="hidden_if_in" source="mode_conteneur_actif">
<param>non</param>
<target type="variable">leader</target>
</condition>
</constraints>
<help/>
</rougail>

View File

@ -0,0 +1 @@
{"rougail.general.mode_conteneur_actif": "non", "rougail.leadermode.leader.leader": [], "rougail.leadermode.leader.follower1": [], "rougail.leadermode.leader.follower2": []}

View File

@ -0,0 +1,36 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<family doc="rougail" name="rougail">
<family doc="general" name="general">
<property>expert</property>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>expert</property>
<value type="string">non</value>
</variable>
</family>
<family doc="leadermode" name="leadermode">
<property>normal</property>
<leader doc="leader" name="leader">
<property>normal</property>
<property expected="non" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">hidden</property>
<variable doc="leader" multi="True" name="leader" type="string">
<property expected="non" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">frozen</property>
<property expected="non" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">force_default_on_freeze</property>
</variable>
<variable doc="follower1" multi="False" name="follower1" type="string">
<property>normal</property>
<property expected="non" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">frozen</property>
<property expected="non" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">force_default_on_freeze</property>
</variable>
<variable doc="follower2" multi="False" name="follower2" type="string">
<property>normal</property>
<property expected="non" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">frozen</property>
<property expected="non" inverse="False" source="rougail.general.mode_conteneur_actif" type="calculation">force_default_on_freeze</property>
</variable>
</leader>
</family>
</family>
</rougail>

View File

@ -0,0 +1,13 @@
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'expert']), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['expert']), children=[option_3])
option_6 = StrOption(properties=frozenset([Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))]), doc='leader', multi=True, name='leader')
option_7 = StrOption(properties=frozenset(['normal', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))]), doc='follower1', multi=True, name='follower1')
option_8 = StrOption(properties=frozenset(['normal', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))]), doc='follower2', multi=True, name='follower2')
option_5 = Leadership(doc='leader', name='leader', properties=frozenset(['normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))]), children=[option_6, option_7, option_8])
option_4 = OptionDescription(doc='leadermode', name='leadermode', properties=frozenset(['normal']), children=[option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2, option_4])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -0,0 +1,38 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="general">
<variable name="condition" type="oui/non" description="No change">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif2" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<separators/>
</variables>
<constraints>
<condition name="disabled_if_not_in" source="condition">
<param>oui</param>
<target type="variable">mode_conteneur_actif</target>
<target type="variable">mode_conteneur_actif2</target>
<target type="filelist">afilllist</target>
</condition>
<condition name="disabled_if_not_in" source="activer_client_ldap" fallback="True">
<param>non</param>
<target type="variable">mode_conteneur_actif</target>
</condition>
</constraints>
<help/>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -0,0 +1 @@
{"rougail.general.condition": "non"}

View File

@ -0,0 +1,31 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<family doc="rougail" name="rougail">
<family doc="general" name="general">
<property>normal</property>
<variable doc="No change" multi="False" name="condition" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<value type="string">non</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<property expected="oui" inverse="True" source="rougail.general.condition" type="calculation">disabled</property>
<value type="string">non</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif2" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<property expected="oui" inverse="True" source="rougail.general.condition" type="calculation">disabled</property>
<value type="string">non</value>
</variable>
</family>
</family>
</rougail>

View File

@ -0,0 +1,10 @@
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))]), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -0,0 +1,38 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="general">
<variable name="condition" type="oui/non" description="No change">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif2" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<separators/>
</variables>
<constraints>
<condition name="disabled_if_not_in" source="condition" force_inverse_condition_on_fallback="True">
<param>oui</param>
<target type="variable">mode_conteneur_actif</target>
<target type="variable">mode_conteneur_actif2</target>
<target type="filelist">afilllist</target>
</condition>
<condition name="disabled_if_not_in" source="activer_client_ldap" fallback="True">
<param>non</param>
<target type="variable">mode_conteneur_actif</target>
</condition>
</constraints>
<help/>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -0,0 +1 @@
{"rougail.general.condition": "non"}

View File

@ -0,0 +1,31 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<family doc="rougail" name="rougail">
<family doc="general" name="general">
<property>normal</property>
<variable doc="No change" multi="False" name="condition" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<value type="string">non</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<property expected="oui" inverse="True" source="rougail.general.condition" type="calculation">disabled</property>
<value type="string">non</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif2" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<property expected="oui" inverse="True" source="rougail.general.condition" type="calculation">disabled</property>
<value type="string">non</value>
</variable>
</family>
</family>
</rougail>

View File

@ -0,0 +1,10 @@
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))]), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -16,7 +16,6 @@
<property>disabled</property> <property>disabled</property>
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">disabled</property>
<value type="string">non</value> <value type="string">non</value>
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif2" type="choice"> <variable doc="No change" multi="False" name="mode_conteneur_actif2" type="choice">

View File

@ -3,7 +3,7 @@ from rougail.tiramisu import ConvertDynOptionDescription
import imp import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py') func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non')) option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset(['disabled', 'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset(['disabled', 'mandatory', 'normal']), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non')) option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5]) option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2]) option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2])

View File

@ -0,0 +1,38 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="general">
<variable name="condition" type="oui/non" description="No change">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif2" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<separators/>
</variables>
<constraints>
<condition name="disabled_if_in" source="condition">
<param>oui</param>
<target type="variable">mode_conteneur_actif</target>
<target type="variable">mode_conteneur_actif2</target>
<target type="filelist">afilllist</target>
</condition>
<condition name="disabled_if_in" source="activer_client_ldap" fallback="True" force_condition_on_fallback="True">
<param>non</param>
<target type="variable">mode_conteneur_actif</target>
</condition>
</constraints>
<help/>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -0,0 +1 @@
{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"}

View File

@ -0,0 +1,31 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<family doc="rougail" name="rougail">
<family doc="general" name="general">
<property>normal</property>
<variable doc="No change" multi="False" name="condition" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<value type="string">non</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">disabled</property>
<value type="string">non</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif2" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">disabled</property>
<value type="string">non</value>
</variable>
</family>
</family>
</rougail>

View File

@ -0,0 +1,10 @@
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -8,10 +8,10 @@
<variable name="condition" type="oui/non" description="No change"> <variable name="condition" type="oui/non" description="No change">
<value>non</value> <value>non</value>
</variable> </variable>
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True"> <variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value> <value>non</value>
</variable> </variable>
<variable name="mode_conteneur_actif2" type="oui/non" description="No change" hidden="True"> <variable name="mode_conteneur_actif2" type="oui/non" description="No change">
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>

View File

@ -15,8 +15,8 @@
<choice type="string">non</choice> <choice type="string">non</choice>
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">hidden</property> <property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">hidden</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property> <property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property>
<value type="string">non</value> <value type="string">non</value>
</variable> </variable>
@ -25,8 +25,8 @@
<choice type="string">non</choice> <choice type="string">non</choice>
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">hidden</property> <property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">hidden</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property> <property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property>
<value type="string">non</value> <value type="string">non</value>
</variable> </variable>

View File

@ -3,8 +3,8 @@ from rougail.tiramisu import ConvertDynOptionDescription
import imp import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py') func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non')) option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non')) option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5]) option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2]) option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -8,10 +8,10 @@
<variable name="condition" type="oui/non" description="No change"> <variable name="condition" type="oui/non" description="No change">
<value>non</value> <value>non</value>
</variable> </variable>
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True"> <variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value> <value>non</value>
</variable> </variable>
<variable name="mode_conteneur_actif2" type="oui/non" description="No change" hidden="True"> <variable name="mode_conteneur_actif2" type="oui/non" description="No change">
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>

View File

@ -15,8 +15,8 @@
<choice type="string">non</choice> <choice type="string">non</choice>
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">hidden</property> <property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">hidden</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property> <property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property>
<value name="calc_val" type="calculation"> <value name="calc_val" type="calculation">
<param type="string">non</param> <param type="string">non</param>
@ -27,8 +27,8 @@
<choice type="string">non</choice> <choice type="string">non</choice>
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">hidden</property> <property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">hidden</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property> <property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property>
<value type="string">non</value> <value type="string">non</value>
</variable> </variable>

View File

@ -3,8 +3,8 @@ from rougail.tiramisu import ConvertDynOptionDescription
import imp import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py') func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non')) option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif', default=Calculation(func.calc_val, Params((ParamValue("non")), kwargs={})), values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif', default=Calculation(func.calc_val, Params((ParamValue("non")), kwargs={})), values=('oui', 'non'))
option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non')) option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5]) option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2]) option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -8,10 +8,10 @@
<variable name="condition" type="string" description="No change"> <variable name="condition" type="string" description="No change">
<value>tous</value> <value>tous</value>
</variable> </variable>
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True"> <variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value> <value>non</value>
</variable> </variable>
<variable name="mode_conteneur_actif2" type="oui/non" description="No change" hidden="True"> <variable name="mode_conteneur_actif2" type="oui/non" description="No change">
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>

View File

@ -16,11 +16,11 @@
<choice type="string">non</choice> <choice type="string">non</choice>
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">hidden</property> <property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">hidden</property>
<property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property> <property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property>
<property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">hidden</property> <property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">hidden</property>
<property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property> <property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property>
<value type="string">non</value> <value type="string">non</value>
</variable> </variable>
@ -29,11 +29,11 @@
<choice type="string">non</choice> <choice type="string">non</choice>
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">hidden</property> <property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">hidden</property>
<property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property> <property expected="tous" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property>
<property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">hidden</property> <property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">hidden</property>
<property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property> <property expected="authentifié" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property>
<value type="string">non</value> <value type="string">non</value>
</variable> </variable>

View File

@ -3,8 +3,8 @@ from rougail.tiramisu import ConvertDynOptionDescription
import imp import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py') func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='tous', values=('tous', 'authentifié', 'aucun')) option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='tous', values=('tous', 'authentifié', 'aucun'))
option_4 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')}))]), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')}))]), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non')) option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('tous')})), Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('authentifié')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5]) option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2]) option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -0,0 +1,39 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="Général">
<variable name="condition" type="oui/non" description="No change">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif" type="oui/non" description="No change" >
<value>non</value>
</variable>
<variable name="mode_conteneur_actif2" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<family name="Général2">
<variable name="mode_conteneur_actif3" type="oui/non" description="No change" hidden="True">
<value>non</value>
</variable>
</family>
<separators/>
</variables>
<constraints>
<condition name="hidden_if_in" source="condition">
<param>oui</param>
<target type="variable">mode_conteneur_actif</target>
<target type="variable">mode_conteneur_actif2</target>
<target type="family">Général2</target>
</condition>
</constraints>
<help/>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -0,0 +1 @@
{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "rougail.general2.mode_conteneur_actif3": "non"}

View File

@ -0,0 +1,51 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<family doc="rougail" name="rougail">
<family doc="Général" name="general">
<property>normal</property>
<variable doc="No change" multi="False" name="condition" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<value type="string">non</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">hidden</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property>
<value type="string">non</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif2" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">hidden</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property>
<value type="string">non</value>
</variable>
</family>
<family doc="Général2" name="general2">
<property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">hidden</property>
<variable doc="No change" multi="False" name="mode_conteneur_actif3" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>force_default_on_freeze</property>
<property>frozen</property>
<property>hidden</property>
<property>mandatory</property>
<property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">frozen</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">force_default_on_freeze</property>
<value type="string">non</value>
</variable>
</family>
</family>
</rougail>

View File

@ -0,0 +1,12 @@
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='Général', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5])
option_7 = ChoiceOption(properties=frozenset(['force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif3', default='non', values=('oui', 'non'))
option_6 = OptionDescription(doc='Général2', name='general2', properties=frozenset(['normal', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), children=[option_7])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2, option_6])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -8,10 +8,10 @@
<variable name="condition" type="oui/non" description="No change"> <variable name="condition" type="oui/non" description="No change">
<value>non</value> <value>non</value>
</variable> </variable>
<variable name="mode_conteneur_actif" type="oui/non" description="No change"> <variable name="mode_conteneur_actif" type="string" description="No change">
<value>non</value> <value>non</value>
</variable> </variable>
<variable name="mode_conteneur_actif2" type="oui/non" description="No change"> <variable name="mode_conteneur_actif2" type="string" description="No change">
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>

View File

@ -10,17 +10,13 @@
<property>normal</property> <property>normal</property>
<value type="string">non</value> <value type="string">non</value>
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice"> <variable doc="No change" multi="False" name="mode_conteneur_actif" type="string">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">mandatory</property> <property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">mandatory</property>
<value type="string">non</value> <value type="string">non</value>
</variable> </variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif2" type="choice"> <variable doc="No change" multi="False" name="mode_conteneur_actif2" type="string">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property> <property>mandatory</property>
<property>normal</property> <property>normal</property>
<property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">mandatory</property> <property expected="oui" inverse="False" source="rougail.general.condition" type="calculation">mandatory</property>

View File

@ -3,8 +3,8 @@ from rougail.tiramisu import ConvertDynOptionDescription
import imp import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py') func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non')) option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='condition', default='non', values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non')) option_4 = StrOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif', default='non')
option_5 = ChoiceOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non')) option_5 = StrOption(properties=frozenset(['mandatory', 'normal', Calculation(calc_value, Params(ParamValue('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))]), doc='No change', multi=False, name='mode_conteneur_actif2', default='non')
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5]) option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2]) option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -1,24 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change"/>
</family>
<separators/>
</variables>
<constraints>
<check name="valid_enum" target="mode_conteneur_actif">
<param>['a','b','c']</param>
<param name="checkval">True</param>
</check>
</constraints>
<help/>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1 +0,0 @@
{"rougail.general.mode_conteneur_actif": "a"}

View File

@ -1,16 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<family doc="rougail" name="rougail">
<family doc="general" name="general">
<property>normal</property>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
<choice type="string">a</choice>
<choice type="string">b</choice>
<choice type="string">c</choice>
<property>mandatory</property>
<property>normal</property>
<value type="string">a</value>
</variable>
</family>
</family>
</rougail>

View File

@ -1,8 +0,0 @@
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='mode_conteneur_actif', default='a', values=('a', 'b', 'c'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -25,7 +25,6 @@
</variable> </variable>
<variable doc="activate" multi="False" name="activate" type="boolean"> <variable doc="activate" multi="False" name="activate" type="boolean">
<property>disabled</property> <property>disabled</property>
<property expected="oui" inverse="True" source="rougail.general.mode_conteneur_actif2" type="calculation">disabled</property>
<value type="boolean">True</value> <value type="boolean">True</value>
</variable> </variable>
</family> </family>

View File

@ -13,7 +13,7 @@ option_12 = StrOption(properties=frozenset([]), doc='name', multi=False, name='n
option_13 = StrOption(properties=frozenset([]), doc='owner', multi=False, name='owner', default='root') option_13 = StrOption(properties=frozenset([]), doc='owner', multi=False, name='owner', default='root')
option_14 = StrOption(properties=frozenset([]), doc='source', multi=False, name='source', default='file') option_14 = StrOption(properties=frozenset([]), doc='source', multi=False, name='source', default='file')
option_15 = BoolOption(default=True, properties=frozenset([]), doc='templating', multi=False, name='templating') option_15 = BoolOption(default=True, properties=frozenset([]), doc='templating', multi=False, name='templating')
option_16 = BoolOption(default=True, properties=frozenset(['disabled', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))]), doc='activate', multi=False, name='activate') option_16 = BoolOption(default=True, properties=frozenset(['disabled']), doc='activate', multi=False, name='activate')
option_9 = OptionDescription(doc='file', name='file', children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) option_9 = OptionDescription(doc='file', name='file', children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16])
option_8 = OptionDescription(name='files', doc='files', children=[option_9]) option_8 = OptionDescription(name='files', doc='files', children=[option_9])
option_7 = OptionDescription(doc='test', name='test', children=[option_8]) option_7 = OptionDescription(doc='test', name='test', children=[option_8])

View File

@ -1 +1 @@
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true, "services.test.files.file1.activate": false} {"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true}

View File

@ -24,7 +24,8 @@
<value type="boolean">True</value> <value type="boolean">True</value>
</variable> </variable>
<variable doc="activate" multi="False" name="activate" type="boolean"> <variable doc="activate" multi="False" name="activate" type="boolean">
<value type="boolean">False</value> <property>disabled</property>
<value type="boolean">True</value>
</variable> </variable>
</family> </family>
</family> </family>

View File

@ -12,7 +12,7 @@ option_11 = StrOption(properties=frozenset([]), doc='name', multi=False, name='n
option_12 = StrOption(properties=frozenset([]), doc='owner', multi=False, name='owner', default='root') option_12 = StrOption(properties=frozenset([]), doc='owner', multi=False, name='owner', default='root')
option_13 = StrOption(properties=frozenset([]), doc='source', multi=False, name='source', default='file1') option_13 = StrOption(properties=frozenset([]), doc='source', multi=False, name='source', default='file1')
option_14 = BoolOption(default=True, properties=frozenset([]), doc='templating', multi=False, name='templating') option_14 = BoolOption(default=True, properties=frozenset([]), doc='templating', multi=False, name='templating')
option_15 = BoolOption(default=False, properties=frozenset([]), doc='activate', multi=False, name='activate') option_15 = BoolOption(default=True, properties=frozenset(['disabled']), doc='activate', multi=False, name='activate')
option_8 = OptionDescription(doc='file1', name='file1', children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15]) option_8 = OptionDescription(doc='file1', name='file1', children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15])
option_7 = OptionDescription(name='files', doc='files', children=[option_8]) option_7 = OptionDescription(name='files', doc='files', children=[option_8])
option_6 = OptionDescription(doc='test', name='test', children=[option_7]) option_6 = OptionDescription(doc='test', name='test', children=[option_7])

View File

@ -15,6 +15,11 @@
<value>non</value> <value>non</value>
</variable> </variable>
</family> </family>
<family name="disabled_family">
<variable name="mode_conteneur_actif3" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<separators/> <separators/>
</variables> </variables>
@ -23,6 +28,7 @@
<param>oui</param> <param>oui</param>
<target type="variable">mode_conteneur_actif1</target> <target type="variable">mode_conteneur_actif1</target>
<target type="variable" optional="True">mode_conteneur_actif2</target> <target type="variable" optional="True">mode_conteneur_actif2</target>
<target type="family">disabled_family</target>
</condition> </condition>
</constraints> </constraints>

View File

@ -27,5 +27,16 @@
<value type="string">non</value> <value type="string">non</value>
</variable> </variable>
</family> </family>
<family doc="disabled_family" name="disabled_family">
<property>disabled</property>
<property>normal</property>
<variable doc="No change" multi="False" name="mode_conteneur_actif3" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<value type="string">non</value>
</variable>
</family>
</family> </family>
</rougail> </rougail>

View File

@ -6,5 +6,7 @@ option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No c
option_4 = ChoiceOption(properties=frozenset(['disabled', 'mandatory', 'normal']), doc='No change', multi=False, name='mode_conteneur_actif1', default='non', values=('oui', 'non')) option_4 = ChoiceOption(properties=frozenset(['disabled', 'mandatory', 'normal']), doc='No change', multi=False, name='mode_conteneur_actif1', default='non', values=('oui', 'non'))
option_5 = ChoiceOption(properties=frozenset(['disabled', 'mandatory', 'normal']), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non')) option_5 = ChoiceOption(properties=frozenset(['disabled', 'mandatory', 'normal']), doc='No change', multi=False, name='mode_conteneur_actif2', default='non', values=('oui', 'non'))
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5]) option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4, option_5])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2]) option_7 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='mode_conteneur_actif3', default='non', values=('oui', 'non'))
option_6 = OptionDescription(doc='disabled_family', name='disabled_family', properties=frozenset(['disabled', 'normal']), children=[option_7])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2, option_6])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -0,0 +1,35 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="oui/non" description="No change">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif1" type="oui/non" description="No change" multi="True">
<value>non</value>
</variable>
<variable name="mode_conteneur_actif2" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<separators/>
</variables>
<constraints>
<condition fallback="True" name="hidden_if_in" source="condition">
<param>oui</param>
<target type="variable">mode_conteneur_actif1</target>
</condition>
<group leader="mode_conteneur_actif1">
<follower>mode_conteneur_actif2</follower>
</group>
</constraints>
<help/>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -0,0 +1 @@
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": ["non"], "rougail.general.mode_conteneur_actif1.mode_conteneur_actif2": ["non"]}

View File

@ -0,0 +1,36 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<family doc="rougail" name="rougail">
<family doc="general" name="general">
<property>normal</property>
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>mandatory</property>
<property>normal</property>
<value type="string">non</value>
</variable>
<leader doc="No change" name="mode_conteneur_actif1">
<property>hidden</property>
<property>normal</property>
<variable doc="No change" multi="True" name="mode_conteneur_actif1" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>force_default_on_freeze</property>
<property>frozen</property>
<property>mandatory</property>
<value type="string">non</value>
</variable>
<variable doc="No change" multi="False" name="mode_conteneur_actif2" type="choice">
<choice type="string">oui</choice>
<choice type="string">non</choice>
<property>force_default_on_freeze</property>
<property>frozen</property>
<property>mandatory</property>
<property>normal</property>
<value type="string">non</value>
</variable>
</leader>
</family>
</family>
</rougail>

View File

@ -0,0 +1,11 @@
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset(['mandatory', 'normal']), doc='No change', multi=False, name='mode_conteneur_actif', default='non', values=('oui', 'non'))
option_5 = ChoiceOption(properties=frozenset(['force_default_on_freeze', 'frozen', 'mandatory']), doc='No change', multi=True, name='mode_conteneur_actif1', default=['non'], values=('oui', 'non'))
option_6 = ChoiceOption(properties=frozenset(['force_default_on_freeze', 'frozen', 'mandatory', 'normal']), doc='No change', multi=True, name='mode_conteneur_actif2', default_multi='non', values=('oui', 'non'))
option_4 = Leadership(doc='No change', name='mode_conteneur_actif1', properties=frozenset(['hidden', 'normal']), children=[option_5, option_6])
option_2 = OptionDescription(doc='general', name='general', properties=frozenset(['normal']), children=[option_3, option_4])
option_1 = OptionDescription(doc='rougail', name='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -11,7 +11,7 @@
<constraints> <constraints>
<fill name='calc_multi_condition' target='extra.ejabberd.day'> <fill name='calc_multi_condition' target='extra.ejabberd.day'>
<param>non</param> <param>non</param>
<param type='eole' name='condition_1' hidden='False'>activer_ejabberd</param> <param type='variable' name='condition_1'>activer_ejabberd</param>
<param name='match'>none</param> <param name='match'>none</param>
<param name='mismatch'>daily</param> <param name='mismatch'>daily</param>
</fill> </fill>

View File

@ -11,7 +11,7 @@
<constraints> <constraints>
<fill name='calc_multi_condition' target='extra1.external.description'> <fill name='calc_multi_condition' target='extra1.external.description'>
<param>non</param> <param>non</param>
<param type='eole' name='condition_1' hidden='False'>extra.ejabberd.day</param> <param type='variable' name='condition_1'>extra.ejabberd.day</param>
<param name='match'>none</param> <param name='match'>none</param>
<param name='mismatch'>daily</param> <param name='mismatch'>daily</param>
</fill> </fill>

View File

@ -1,22 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="général">
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
<value>non</value>
</variable>
</family>
<separators/>
</variables>
<constraints>
</constraints>
<help/>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1,26 +0,0 @@
<rougail>
<family_action name="systeme"
description="Liste des actions pour gérer le système EOLE"
color="#ddc9e6"
image="system.svg">
<action type="form"
title="Reconfigure"
description="Reconfigurer le serveur"
image="backup.svg">
<input>Reconfigurer</input>
<profile>ead_admin</profile>
<ewtapp>ead</ewtapp>
<tag>reconfigure</tag>
</action>
</family_action>
<variables>
<family name="test">
<variable name="delay" type="number" description="délai en minutes avant lancement">
<value>0</value>
</variable>
</family>
</variables>
<constraints>
</constraints>
<help/>
</rougail>

View File

@ -1,22 +0,0 @@
<rougail>
<family_action name="systeme"
description="Liste des actions pour gérer le système EOLE"
color="#ddc9e6"
image="system.svg">
<action type="form"
title="Reconfigure2"
description="Reconfigurer le serveur2"
image="backup.svg">
<input>Reconfigurer2</input>
<profile>ead_admin</profile>
<ewtapp>ead</ewtapp>
<tag>reconfigure</tag>
</action>
</family_action>
<variables>
</variables>
<constraints>
</constraints>
<help/>
</rougail>

View File

@ -1,25 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_save="True">
<value>non</value>
</variable>
</family>
<separators/>
</variables>
<constraints>
<auto name="calc_val" target="mode_conteneur_actif">
<param>value</param>
</auto>
</constraints>
<help/>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<rougail> <rougail>
<containers> <services>
<container name='test' id='23'> <service name='test'>
<file name='file_name' name_type="variable"/> <file name='file_name' file_type="variable"/>
</container> </service>
</containers> </services>
<variables> <variables>
<family name='général'> <family name='général'>
<variable name='mode_conteneur_actif' type='oui/non' description="No change" hidden="True"> <variable name='mode_conteneur_actif' type='oui/non' description="No change" hidden="True">

View File

@ -1,11 +1,11 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<rougail> <rougail>
<containers> <services>
<container name="test" id="23"> <service name="test">
<file name="/etc/mailname"/> <file name="/etc/mailname"/>
</container> </service>
</containers> </services>
<variables> <variables>

View File

@ -1,10 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<rougail> <rougail>
<containers> <services>
<container name="test" id="23"> <service name="test">
<file name="/etc/mailname" source="mailname.new"/> <file name="/etc/mailname" source="mailname.new"/>
</container> </service>
</containers> </services>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

View File

@ -1,24 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="proxy authentifié">
<variable name="toto1" type="port" description="Port d'écoute du proxy" mode="expert">
</variable>
<variable name="toto2" type="port" description="Port d'écoute du proxy NTLM" mode="expert">
<value>3127</value>
</variable>
</family>
</variables>
<constraints>
<fill name="calc_multi_condition" target="toto1">
<param>non</param>
<param type="container" name="condition_3" hidden="False"/>
<param name="match">3128</param>
<param name="mismatch" type="variable" hidden="False">toto2</param>
</fill>
</constraints>
</rougail>

View File

@ -15,9 +15,9 @@
<constraints> <constraints>
<fill name="calc_multi_condition" target="toto1"> <fill name="calc_multi_condition" target="toto1">
<param>non</param> <param>non</param>
<param type="variable" name="condition_1" hidden="False"/> <param type="variable" name="condition_1" notraisepropertyerror="False"/>
<param name="match">3128</param> <param name="match">3128</param>
<param name="mismatch" type="variable" hidden="False">toto2</param> <param name="mismatch" type="variable" notraisepropertyerror="False">toto2</param>
</fill> </fill>
</constraints> </constraints>

View File

@ -15,9 +15,9 @@
<constraints> <constraints>
<fill name="calc_multi_condition" target="toto1"> <fill name="calc_multi_condition" target="toto1">
<param>non</param> <param>non</param>
<param type="number" name="condition_2" hidden="False"/> <param type="number" name="condition_2" notraisepropertyerror="False"/>
<param name="match">3128</param> <param name="match">3128</param>
<param name="mismatch" type="variable" hidden="False">toto2</param> <param name="mismatch" type="variable" notraisepropertyerror="False">toto2</param>
</fill> </fill>
</constraints> </constraints>

View File

@ -1,8 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<rougail> <rougail>
<services/>
<variables> <variables>
<family name="general"> <family name="general">
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_freeze="True"> <variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_freeze="True">
@ -11,15 +8,11 @@
</family> </family>
<separators/> <separators/>
</variables> </variables>
<constraints> <constraints>
<auto name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val" target="mode_conteneur_actif">
<param>value</param> <param>value</param>
</auto> </fill>
</constraints> </constraints>
<help/>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab
--> -->

Some files were not shown because too many files have changed in this diff Show More