same target and param in check|condition|fill

This commit is contained in:
Emmanuel Garette 2021-02-08 17:46:58 +01:00
parent 0100c692b2
commit 6f05c22a3d
230 changed files with 1054 additions and 648 deletions

View File

@ -2,10 +2,12 @@
## Les variables ## Les variables
- [Le conteneur des variables](variables.md)
- [Les familles](family/README.md) - [Les familles](family/README.md)
- [Les variables](variable/README.md) - [Les variables](variable/README.md)
## Les services
## Les contraintes ## Les contraintes
- [Les calcules automatiques](fill/README.md) - [Les calcules automatiques](fill/README.md)
- [Les vérifications des valeurs](check/README.md)

View File

@ -1,2 +0,0 @@
<!ATTLIST variable remove_check (True|False) "False">

View File

@ -1 +1,10 @@
FIXME
<!ATTLIST variable remove_condition (True|False) "False"> <!ATTLIST variable remove_condition (True|False) "False">
<!ELEMENT condition ((target | param)+ )>
<!ATTLIST condition name (disabled_if_in|disabled_if_not_in|hidden_if_in|hidden_if_not_in|mandatory_if_in|mandatory_if_not_in) #REQUIRED>
<!ATTLIST condition source CDATA #REQUIRED>
<!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">

View File

@ -95,6 +95,8 @@ Créons deux variables avec une contrainte de type variable qui contient le nom
Si l'utilisateur laisse la valeur 1 à "my_variable", la valeur par défault de la variable "my_calculated_variable" sera "no". Si l'utilisateur laisse la valeur 1 à "my_variable", la valeur par défault de la variable "my_calculated_variable" sera "no".
Si la valeur de "my_variable" est différent de 1, la valeur par défaut de la variable "my_calculated_variable" sera "yes". Si la valeur de "my_variable" est différent de 1, la valeur par défaut de la variable "my_calculated_variable" sera "yes".
[Les variables meneuses ou suiveuses](../variable/leadership.md) peuvent être utilisé sans soucis commme paramètre.
### Paramètre avec variable potentiellement non existante ### Paramètre avec variable potentiellement non existante
Suivant le contexte une variable peut exister ou ne pas exister. Suivant le contexte une variable peut exister ou ne pas exister.
@ -120,20 +122,29 @@ Si maintenant on créé un nouveau dictionnaire en créant cette variable, la fo
### Paramètre avec variable potentiellement désactivée ### Paramètre avec variable potentiellement désactivée
FIXME : <!ATTLIST param notraisepropertyerror (True|False) "False"> Si une variable est désactivé, l'utilisation de cette variable peut poser problème.
Il n'y a pas spécialement de test ! Il est possible de ne pas générer d'erreur si une variable est désactivé en utilisant le paramètre "propertyerror" :
### Paramètre avec variable suiveuse ```
<variables>
<family name="general">
<variable name="condition">
<value>no</value>
</variable>
<variable name="variable1" disabled="True"/>
<variable name="variable2"/>
</family>
</variables>
[variable suiveuse](variable/leadership.md) <constraints>
<fill name="calc_val" target="variable2">
<param type="variable" propertyerror="False">variable1</param>
</fill>
</constraints>
```
FIXME : Dans ce cas, le paramètre n'est jamais donnée à la fonction de destination.
- tests/flattener_dicos/10leadership_append/00-base.xml
- tests/flattener_dicos/10leadership_auto/00-base.xml
- tests/flattener_dicos/10leadership_autoleader/00-base.xml
- tests/flattener_dicos/10leadership_autoleader_expert/00-base.xml
### Paramètre avec variable dynamique ### Paramètre avec variable dynamique

View File

@ -58,4 +58,3 @@ Dans un second dictionnaire supprimer ce calcul :
</family> </family>
</variables> </variables>
``` ```

View File

@ -44,6 +44,13 @@ En ajoutant le paramètre "hidden" à "True" dans la variable précédente, l'ut
Si une condition "hidden_if_in" est spécifié à la variable, la valeur sera modifiable par l'utilisateur si elle n'est pas cachée mais elle sera systèmatiquement calculée (même si elle a déjà était modifiée) si la variable est cachée. Si une condition "hidden_if_in" est spécifié à la variable, la valeur sera modifiable par l'utilisateur si elle n'est pas cachée mais elle sera systèmatiquement calculée (même si elle a déjà était modifiée) si la variable est cachée.
## Variable meneuse ou suiveuse avec valeur calculé
Une [variable suiveuse](../variable/leadership.md) ne peut pas être calculé automatiquement.
Une [variable meneuse](../variable/leadership.md) peut être calculé automatiquement.
Si la variable n'est pas multiple, il ne faut pas que le calcule retourne une liste.
## Variable dynamique avec une valeur calculée ## Variable dynamique avec une valeur calculée
Il est également possible de calculer [une variable d'une famille dynamique](family/auto.md) à partir d'une variable standard : Il est également possible de calculer [une variable d'une famille dynamique](family/auto.md) à partir d'une variable standard :

View File

@ -190,6 +190,8 @@ Par exemple, si la valeur de cette variable est issue d'un calcul, la valeur ne
Ces variables sont généralement des variables obligatoires. En effet ces variable ne sont automatiquement modifiées que si elles ont une valeurs. Ces variables sont généralement des variables obligatoires. En effet ces variable ne sont automatiquement modifiées que si elles ont une valeurs.
Une [variable meneuse ou suiveuse](leadership.md) ne peut pas avoir la propriété auto_save.
## Variable à valeur en lecture seule automatique ## Variable à valeur en lecture seule automatique
Une variable avec valeur en lecture seule automatique est une variable dont la valeur ne sera plus modifiable par l'utilisateur quand le serveur sera déployé. Une variable avec valeur en lecture seule automatique est une variable dont la valeur ne sera plus modifiable par l'utilisateur quand le serveur sera déployé.
@ -204,3 +206,5 @@ Dans ce cas la valeur est fixée à la valeur actuelle et elle ne sera plus modi
Par exemple, si la valeur de cette variable est issue d'un calcul, la valeur ne sera plus recalculée. Par exemple, si la valeur de cette variable est issue d'un calcul, la valeur ne sera plus recalculée.
Ces variables sont généralement des variables obligatoires. En effet ces variable ne sont en lecteur seul que si elles sont une valeurs. Ces variables sont généralement des variables obligatoires. En effet ces variable ne sont en lecteur seul que si elles sont une valeurs.
Une [variable meneuse ou suiveuse](leadership.md) ne peut pas avoir la propriété auto_freeze.

View File

@ -27,14 +27,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from typing import List, Any from typing import List, Any
from .variable import CONVERT_OPTION from .variable import CONVERT_OPTION
from .target import TargetAnnotator
from .param import ParamAnnotator
from ..utils import load_modules from ..utils import load_modules
from ..i18n import _ from ..i18n import _
from ..error import DictConsistencyError from ..error import DictConsistencyError, display_xmlfiles
INTERNAL_FUNCTIONS = ['valid_enum', 'valid_in_network', 'valid_differ', 'valid_entier'] INTERNAL_FUNCTIONS = ['valid_enum', 'valid_in_network', 'valid_differ', 'valid_entier']
class CheckAnnotator: class CheckAnnotator(TargetAnnotator, ParamAnnotator):
"""Annotate check """Annotate check
""" """
def __init__(self, def __init__(self,
@ -45,12 +47,19 @@ class CheckAnnotator:
not hasattr(objectspace.space.constraints, 'check'): not hasattr(objectspace.space.constraints, 'check'):
return return
self.objectspace = objectspace self.objectspace = objectspace
self.let_none = True
self.only_variable = True
self.functions = dir(load_modules(eosfunc_file)) self.functions = dir(load_modules(eosfunc_file))
self.functions.extend(INTERNAL_FUNCTIONS) self.functions.extend(INTERNAL_FUNCTIONS)
self.target_is_uniq = False
self.convert_target(self.objectspace.space.constraints.check)
self.convert_param(self.objectspace.space.constraints.check)
self.check_check() self.check_check()
self.check_valid_enum() self.check_valid_enum()
self.check_change_warning() self.check_change_warning()
self.convert_valid_entier()
self.convert_check() self.convert_check()
del objectspace.space.constraints.check
def check_check(self): # pylint: disable=R0912 def check_check(self): # pylint: disable=R0912
"""valid and manage <check> """valid and manage <check>
@ -58,56 +67,14 @@ class CheckAnnotator:
remove_indexes = [] remove_indexes = []
for check_idx, check in enumerate(self.objectspace.space.constraints.check): for check_idx, check in enumerate(self.objectspace.space.constraints.check):
if not check.name in self.functions: if not check.name in self.functions:
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) msg = _(f'cannot find check function "{check.name}"')
msg = _(f'cannot find check function "{check.name}" in {xmlfiles}') raise DictConsistencyError(msg, 1, check.xmlfiles)
raise DictConsistencyError(msg, 1) if hasattr(check, 'param') and check.param == []:
check_name = check.target
# let's replace the target by the an object
try:
check.target = self.objectspace.paths.get_variable(check.target)
except DictConsistencyError as err:
if err.errno == 36:
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
msg = _(f'the target "{check.target}" in check cannot be a dynamic '
f'variable in {xmlfiles}')
raise DictConsistencyError(msg, 22) from err
raise err
check.is_in_leadership = self.objectspace.paths.is_in_leadership(check_name)
if not hasattr(check, 'param'):
continue
param_option_indexes = []
for idx, param in enumerate(check.param):
if param.type == 'variable':
if not self.objectspace.paths.path_is_defined(param.text):
if not param.optional:
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
msg = _(f'cannot find check param "{param.text}" in {xmlfiles}')
raise DictConsistencyError(msg, 2)
param_option_indexes.append(idx)
else:
# let's replace params by the path
param.text = self.objectspace.paths.get_variable(param.text)
param_option_indexes.sort(reverse=True)
for idx in param_option_indexes:
check.param.pop(idx)
if check.param == []:
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.objectspace.space.constraints.check[idx] del self.objectspace.space.constraints.check[idx]
@staticmethod
def check_valid_enum_value(variable,
values,
) -> None:
"""check that values in valid_enum are valid
"""
for value in variable.value:
if value.name not in values:
msg = _(f'value "{value.name}" of variable "{variable.name}" is not in list '
f'of all expected values ({values})')
raise DictConsistencyError(msg, 15)
def check_valid_enum(self): def check_valid_enum(self):
"""verify valid_enum """verify valid_enum
""" """
@ -115,32 +82,30 @@ class CheckAnnotator:
for idx, check in enumerate(self.objectspace.space.constraints.check): for idx, check in enumerate(self.objectspace.space.constraints.check):
if check.name != 'valid_enum': if check.name != 'valid_enum':
continue continue
if check.target.path in self.objectspace.valid_enums: for target in check.target:
check_xmlfiles = self.objectspace.valid_enums[check.target.path]['xmlfiles'] if target.name.path in self.objectspace.valid_enums:
old_xmlfiles = self.objectspace.display_xmlfiles(check_xmlfiles) check_xmlfiles = display_xmlfiles(self.objectspace.valid_enums\
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) [target.name.path]['xmlfiles'])
msg = _(f'valid_enum define in {xmlfiles} but already set in {old_xmlfiles} ' msg = _(f'valid_enum already set in {check_xmlfiles} '
f'for "{check.target.name}", did you forget remove_check?') f'for "{target.name.name}", you may have forget remove_check')
raise DictConsistencyError(msg, 3) raise DictConsistencyError(msg, 3, check.xmlfiles)
if not hasattr(check, 'param'): if not hasattr(check, 'param'):
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) msg = _(f'param is mandatory for a valid_enum of variable "{target.name.name}"')
msg = _(f'param is mandatory for a valid_enum of variable "{check.target.name}" ' raise DictConsistencyError(msg, 4, check.xmlfiles)
f'in {xmlfiles}') variable_type = target.name.type
raise DictConsistencyError(msg, 4) values = self._set_valid_enum(target.name,
variable_type = check.target.type
values = self._set_valid_enum(check.target,
check, check,
) )
if values: if values:
if hasattr(check.target, 'value'): if hasattr(target.name, 'value'):
# check value # check value
self.check_valid_enum_value(check.target, values) self.check_valid_enum_value(target.name, values)
else: else:
# no value, set the first choice has default value # no value, set the first choice has default value
new_value = self.objectspace.value(check.xmlfiles) new_value = self.objectspace.value(check.xmlfiles)
new_value.name = values[0] new_value.name = values[0]
new_value.type = variable_type new_value.type = variable_type
check.target.value = [new_value] target.name.value = [new_value]
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:
@ -161,47 +126,36 @@ class CheckAnnotator:
values = [] values = []
for param in check.param: for param in check.param:
if has_variable: if has_variable:
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
msg = _(f'only one "variable" parameter is allowed for valid_enum ' msg = _(f'only one "variable" parameter is allowed for valid_enum '
f'of variable "{variable.name}" in {xmlfiles}') f'of variable "{variable.name}"')
raise DictConsistencyError(msg, 5) raise DictConsistencyError(msg, 5, param.xmlfiles)
param_type = variable_type param_type = variable_type
if param.type == 'variable': if param.type == 'variable':
has_variable = True has_variable = True
if param.optional is True: if param.optional is True:
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
msg = _(f'optional parameter in valid_enum for variable "{variable.name}" ' msg = _(f'optional parameter in valid_enum for variable "{variable.name}" '
f'is not allowed in {xmlfiles}') f'is not allowed')
raise DictConsistencyError(msg, 14) raise DictConsistencyError(msg, 14, param.xmlfiles)
param_variable = param.text if not param.text.multi:
if not param_variable.multi:
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
msg = _(f'only multi "variable" parameter is allowed for valid_enum ' msg = _(f'only multi "variable" parameter is allowed for valid_enum '
f'of variable "{variable.name}" in {xmlfiles}') f'of variable "{variable.name}"')
raise DictConsistencyError(msg, 6) raise DictConsistencyError(msg, 6, param.xmlfiles)
param_type = 'calculation' param_type = 'calculation'
value = param.text value = param.text
elif param.type == 'nil':
value = None
else: else:
if 'type' in vars(param) and variable_type != param.type: if 'type' in vars(param) and variable_type != param.type:
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
msg = _(f'parameter in valid_enum has incompatible type "{param.type}" ' msg = _(f'parameter in valid_enum has incompatible type "{param.type}" '
f'with type of the variable "{variable.name}" ("{variable_type}") ' f'with type of the variable "{variable.name}" ("{variable_type}")')
f'in {xmlfiles}') raise DictConsistencyError(msg, 7, param.xmlfiles)
raise DictConsistencyError(msg, 7)
if hasattr(param, 'text'): if hasattr(param, 'text'):
try: try:
value = CONVERT_OPTION[variable_type].get('func', str)(param.text) value = CONVERT_OPTION[variable_type].get('func', str)(param.text)
except ValueError as err: except ValueError as err:
msg = _(f'unable to change type of a valid_enum entry "{param.text}" ' msg = _(f'unable to change type of a valid_enum entry "{param.text}" '
f'is not a valid "{variable_type}" for "{variable.name}"') f'is not a valid "{variable_type}" for "{variable.name}"')
raise DictConsistencyError(msg, 13) from err raise DictConsistencyError(msg, 13, variable.xmlfiles) from err
else:
if param.type == 'number':
xmlfiles = self.objectspace.display_xmlfiles(param.xmlfiles)
msg = _('param type is number, so value is mandatory for valid_enum '
f'of variable "{variable.name}" in {xmlfiles}')
raise DictConsistencyError(msg, 8)
value = None
values.append(value) values.append(value)
choice = self.objectspace.choice(variable.xmlfiles) choice = self.objectspace.choice(variable.xmlfiles)
choice.name = value choice.name = value
@ -211,12 +165,25 @@ class CheckAnnotator:
if has_variable: if has_variable:
return None return None
self.objectspace.valid_enums[check.target.path] = {'type': variable_type, for target in check.target:
self.objectspace.valid_enums[target.name.path] = {'type': variable_type,
'values': values, 'values': values,
'xmlfiles': check.xmlfiles, 'xmlfiles': check.xmlfiles,
} }
return values return values
@staticmethod
def check_valid_enum_value(variable,
values,
) -> None:
"""check that values in valid_enum are valid
"""
for value in variable.value:
if value.name not in values:
msg = _(f'value "{value.name}" of variable "{variable.name}" is not in list '
f'of all expected values ({values})')
raise DictConsistencyError(msg, 15, value.xmlfiles)
def check_change_warning(self): def check_change_warning(self):
"""convert level to "warnings_only" """convert level to "warnings_only"
""" """
@ -224,30 +191,38 @@ class CheckAnnotator:
check.warnings_only = check.level == 'warning' check.warnings_only = check.level == 'warning'
check.level = None check.level = None
def convert_valid_entier(self) -> None:
"""valid and manage <check>
"""
remove_indexes = []
for check_idx, check in enumerate(self.objectspace.space.constraints.check):
if not check.name == 'valid_entier':
continue
remove_indexes.append(check_idx)
if not hasattr(check, 'param'):
msg = _(f'{check.name} must have, at least, 1 param')
raise DictConsistencyError(msg, 17, check.xmlfiles)
for param in check.param:
if param.type != 'number':
msg = _(f'param in "valid_entier" must be an "integer", not "{param.type}"')
raise DictConsistencyError(msg, 18, check.xmlfiles)
for target in check.target:
if param.name == 'mini':
target.name.min_number = int(param.text)
elif param.name == 'maxi':
target.name.max_number = int(param.text)
else:
msg = _(f'unknown parameter "{param.name}" in check "valid_entier"')
raise DictConsistencyError(msg, 19, check.xmlfiles)
remove_indexes.sort(reverse=True)
for idx in remove_indexes:
del self.objectspace.space.constraints.check[idx]
def convert_check(self) -> None: def convert_check(self) -> None:
"""valid and manage <check> """valid and manage <check>
""" """
for check in self.objectspace.space.constraints.check: for check in self.objectspace.space.constraints.check:
if check.name == 'valid_entier': for target in check.target:
if not hasattr(check, 'param'): if not hasattr(target.name, 'validators'):
msg = _(f'{check.name} must have, at least, 1 param') target.name.validators = []
raise DictConsistencyError(msg, 17) target.name.validators.append(check)
for param in check.param:
if param.type != 'number':
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
msg = _(f'param in "valid_entier" must be an "integer", not "{param.type}"'
f' in {xmlfiles}')
raise DictConsistencyError(msg, 18)
if param.name == 'mini':
check.target.min_number = int(param.text)
elif param.name == 'maxi':
check.target.max_number = int(param.text)
else:
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
msg = _(f'unknown parameter "{param.name}" in check "valid_entier" '
f'for variable "{check.target.name}" in {xmlfiles}')
raise DictConsistencyError(msg, 19)
continue
if not hasattr(check.target, 'validators'):
check.target.validators = []
check.target.validators.append(check)

View File

@ -31,10 +31,13 @@ from ..i18n import _
from ..error import DictConsistencyError from ..error import DictConsistencyError
from ..config import Config from ..config import Config
from .target import TargetAnnotator
from .param import ParamAnnotator
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
class ConditionAnnotator: class ConditionAnnotator(TargetAnnotator, ParamAnnotator):
"""Annotate condition """Annotate condition
""" """
def __init__(self, def __init__(self,
@ -47,7 +50,11 @@ class ConditionAnnotator:
if not hasattr(objectspace.space, 'constraints') or \ if not hasattr(objectspace.space, 'constraints') or \
not hasattr(self.objectspace.space.constraints, 'condition'): not hasattr(self.objectspace.space.constraints, 'condition'):
return return
self.convert_condition_target() self.target_is_uniq = False
self.only_variable = False
self.convert_target(self.objectspace.space.constraints.condition)
self.convert_param(self.objectspace.space.constraints.condition)
self.check_source_target()
self.check_condition_fallback() self.check_condition_fallback()
self.convert_xxxlist() self.convert_xxxlist()
self.convert_condition_source() self.convert_condition_source()
@ -59,13 +66,25 @@ class ConditionAnnotator:
"""convert auto_freeze """convert auto_freeze
only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen
""" """
def _convert_auto_freeze(variable): for variables in self.objectspace.space.variables.values():
for family in variables.family.values():
if not hasattr(family, 'variable'):
continue
for variable in family.variable.values():
if isinstance(variable, self.objectspace.leadership):
for follower in variable.variable:
self._convert_auto_freeze(follower)
else:
self._convert_auto_freeze(variable)
def _convert_auto_freeze(self,
variable: 'self.objectspace.variable',
) -> None:
if not variable.auto_freeze: if not variable.auto_freeze:
return return
if variable.namespace != Config['variable_namespace']: if variable.namespace != Config['variable_namespace']:
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"')
msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}" in {xmlfiles}') raise DictConsistencyError(msg, 49, variable.xmlfiles)
raise DictConsistencyError(msg, 49)
new_condition = self.objectspace.condition(variable.xmlfiles) new_condition = self.objectspace.condition(variable.xmlfiles)
new_condition.name = 'auto_frozen_if_not_in' new_condition.name = 'auto_frozen_if_not_in'
new_condition.namespace = variable.namespace new_condition.namespace = variable.namespace
@ -82,57 +101,17 @@ class ConditionAnnotator:
if not hasattr(self.objectspace.space.constraints, 'condition'): if not hasattr(self.objectspace.space.constraints, 'condition'):
self.objectspace.space.constraints.condition = [] self.objectspace.space.constraints.condition = []
self.objectspace.space.constraints.condition.append(new_condition) self.objectspace.space.constraints.condition.append(new_condition)
for variables in self.objectspace.space.variables.values():
for family in variables.family.values():
if not hasattr(family, 'variable'):
continue
for variable in family.variable.values():
if isinstance(variable, self.objectspace.leadership):
for follower in variable.variable:
_convert_auto_freeze(follower)
else:
_convert_auto_freeze(variable)
def convert_condition_target(self): def check_source_target(self):
"""verify and manage target in condition """verify that source != target in condition
""" """
for condition in self.objectspace.space.constraints.condition: for condition in self.objectspace.space.constraints.condition:
if not hasattr(condition, 'target'): for target in condition.target:
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles) if target.type == 'variable' and \
msg = _(f'target is mandatory in a condition for source "{condition.source}" ' condition.source in [target.name.name, target.name.path]:
f'in {xmlfiles}')
raise DictConsistencyError(msg, 9)
remove_targets = []
for index, target in enumerate(condition.target):
try:
if target.type == 'variable':
if condition.source == target.name:
msg = _('target name and source name must be different: ' msg = _('target name and source name must be different: '
f'{condition.source}') f'{condition.source}')
raise DictConsistencyError(msg, 11) raise DictConsistencyError(msg, 11, condition.xmlfiles)
target.name = self.objectspace.paths.get_variable(target.name)
elif target.type == 'family':
target.name = self.objectspace.paths.get_family(target.name,
condition.namespace,
)
elif target.type.endswith('list') and \
condition.name not in ['disabled_if_in', 'disabled_if_not_in']:
xmlfiles = self.objectspace.display_xmlfiles(target.xmlfiles)
msg = _(f'target "{target.type}" not allow in condition "{condition.name}" '
f'in {xmlfiles}')
raise DictConsistencyError(msg, 10)
except DictConsistencyError as err:
if err.errno != 42:
raise err
# for optional variable
if not target.optional:
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles)
msg = f'cannot found target "{target.name}" in the condition in {xmlfiles}'
raise DictConsistencyError(_(msg), 12) from err
remove_targets.append(index)
remove_targets.sort(reverse=True)
for index in remove_targets:
condition.target.pop(index)
def check_condition_fallback(self): def check_condition_fallback(self):
"""a condition with a fallback **and** the source variable doesn't exist """a condition with a fallback **and** the source variable doesn't exist
@ -140,9 +119,9 @@ class ConditionAnnotator:
remove_conditions = [] remove_conditions = []
for idx, condition in enumerate(self.objectspace.space.constraints.condition): for idx, condition in enumerate(self.objectspace.space.constraints.condition):
# fallback # fallback
if condition.fallback is True and \ if condition.fallback is False or \
not self.objectspace.paths.path_is_defined(condition.source): self.objectspace.paths.path_is_defined(condition.source):
apply_action = False continue
if condition.name in ['disabled_if_in', 'mandatory_if_in', 'hidden_if_in']: if condition.name in ['disabled_if_in', 'mandatory_if_in', 'hidden_if_in']:
apply_action = not condition.force_condition_on_fallback apply_action = not condition.force_condition_on_fallback
else: else:
@ -150,7 +129,6 @@ class ConditionAnnotator:
remove_conditions.append(idx) remove_conditions.append(idx)
if apply_action: if apply_action:
self.force_actions_to_variable(condition) self.force_actions_to_variable(condition)
remove_conditions = list(set(remove_conditions))
remove_conditions.sort(reverse=True) remove_conditions.sort(reverse=True)
for idx in remove_conditions: for idx in remove_conditions:
self.objectspace.space.constraints.condition.pop(idx) self.objectspace.space.constraints.condition.pop(idx)
@ -234,7 +212,6 @@ class ConditionAnnotator:
if target.name in self.force_service_value: if target.name in self.force_service_value:
listvar.default = self.force_service_value[target.name] listvar.default = self.force_service_value[target.name]
continue continue
value = condition.name != 'disabled_if_in'
if listvar.path in fills: if listvar.path in fills:
fill = fills[listvar.path] fill = fills[listvar.path]
or_needed = True or_needed = True
@ -246,7 +223,9 @@ class ConditionAnnotator:
fill.index += 1 fill.index += 1
else: else:
fill = self.objectspace.fill(target.xmlfiles) fill = self.objectspace.fill(target.xmlfiles)
fill.target = listvar.path new_target = self.objectspace.target(target.xmlfiles)
new_target.name = listvar.path
fill.target = [new_target]
fill.name = 'calc_value' fill.name = 'calc_value'
fill.namespace = 'services' fill.namespace = 'services'
fill.index = 0 fill.index = 0
@ -284,7 +263,7 @@ class ConditionAnnotator:
fill.param.append(param5) fill.param.append(param5)
if or_needed: if or_needed:
param6 = self.objectspace.param(target.xmlfiles) param6 = self.objectspace.param(target.xmlfiles)
param6.name = f'condition_operator' param6.name = 'condition_operator'
param6.text = 'OR' param6.text = 'OR'
fill.param.append(param6) fill.param.append(param6)
@ -296,15 +275,12 @@ class ConditionAnnotator:
condition.source = self.objectspace.paths.get_variable(condition.source) condition.source = self.objectspace.paths.get_variable(condition.source)
except DictConsistencyError as err: except DictConsistencyError as err:
if err.errno == 36: if err.errno == 36:
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles)
msg = _(f'the source "{condition.source}" in condition cannot be a dynamic ' msg = _(f'the source "{condition.source}" in condition cannot be a dynamic '
f'variable in {xmlfiles}') f'variable')
raise DictConsistencyError(msg, 20) from err raise DictConsistencyError(msg, 20, condition.xmlfiles) from err
if err.errno == 42: if err.errno == 42:
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles) msg = _(f'the source "{condition.source}" in condition is an unknown variable')
msg = _(f'the source "{condition.source}" in condition is an unknown variable ' raise DictConsistencyError(msg, 23, condition.xmlfiles) from err
f'in {xmlfiles}')
raise DictConsistencyError(msg, 23) from err
raise err from err # pragma: no cover raise err from err # pragma: no cover
def check_choice_option_condition(self): def check_choice_option_condition(self):

View File

@ -138,13 +138,11 @@ class FamilyAnnotator:
leader_mode = None leader_mode = None
for follower in leadership.variable: for follower in leadership.variable:
if follower.auto_save is True: if follower.auto_save is True:
xmlfiles = self.objectspace.display_xmlfiles(leadership.xmlfiles) msg = _(f'leader/followers "{follower.name}" could not be auto_save')
msg = _(f'leader/followers "{follower.name}" could not be auto_save in {xmlfiles}') raise DictConsistencyError(msg, 29, leadership.xmlfiles)
raise DictConsistencyError(msg, 29)
if follower.auto_freeze is True: if follower.auto_freeze is True:
xmlfiles = self.objectspace.display_xmlfiles(leadership.xmlfiles) msg = f'leader/followers "{follower.name}" could not be auto_freeze'
msg = f'leader/followers "{follower.name}" could not be auto_freeze in {xmlfiles}' raise DictConsistencyError(_(msg), 30, leadership.xmlfiles)
raise DictConsistencyError(_(msg), 30)
self._change_variabe_mode(follower, self._change_variabe_mode(follower,
family_mode, family_mode,
is_follower, is_follower,
@ -169,10 +167,9 @@ class FamilyAnnotator:
family.suffixes = self.objectspace.paths.get_variable(family.dynamic) family.suffixes = self.objectspace.paths.get_variable(family.dynamic)
del family.dynamic del family.dynamic
if not family.suffixes.multi: if not family.suffixes.multi:
xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles)
msg = _(f'dynamic family "{family.name}" must be linked ' msg = _(f'dynamic family "{family.name}" must be linked '
f'to multi variable in {xmlfiles}') f'to multi variable')
raise DictConsistencyError(msg, 16) raise DictConsistencyError(msg, 16, family.xmlfiles)
def convert_help(self): def convert_help(self):
"""Convert variable help """Convert variable help

View File

@ -28,8 +28,11 @@ from ..utils import load_modules
from ..i18n import _ from ..i18n import _
from ..error import DictConsistencyError from ..error import DictConsistencyError
from .target import TargetAnnotator
from .param import ParamAnnotator
class FillAnnotator:
class FillAnnotator(TargetAnnotator, ParamAnnotator):
"""Fill annotator """Fill annotator
""" """
def __init__(self, def __init__(self,
@ -41,97 +44,32 @@ class FillAnnotator:
not hasattr(self.objectspace.space.constraints, 'fill'): not hasattr(self.objectspace.space.constraints, 'fill'):
return return
self.functions = dir(load_modules(eosfunc_file)) self.functions = dir(load_modules(eosfunc_file))
self.convert_fill() self.target_is_uniq = True
self.only_variable = True
self.convert_target(self.objectspace.space.constraints.fill)
self.convert_param(self.objectspace.space.constraints.fill)
self.fill_to_value()
del self.objectspace.space.constraints.fill
def convert_fill(self) -> None: def fill_to_value(self) -> None:
"""valid and manage <fill> """valid and manage <fill>
""" """
targets = []
for fill in self.objectspace.space.constraints.fill: for fill in self.objectspace.space.constraints.fill:
# test if it's redefined calculation for target in fill.target:
if fill.target in targets:
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
msg = _(f'A fill already exists for the target of "{fill.target}" created '
f'in {xmlfiles}')
raise DictConsistencyError(msg, 24)
targets.append(fill.target)
# test if the function exists # test if the function exists
if fill.name not in self.functions: if fill.name not in self.functions:
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles) msg = _(f'cannot find fill function "{fill.name}"')
msg = _(f'cannot find fill function "{fill.name}" in {xmlfiles}') raise DictConsistencyError(msg, 25, fill.xmlfiles)
raise DictConsistencyError(msg, 25)
# let's replace the target by the path
fill.target, suffix = self.objectspace.paths.get_variable_path(fill.target,
fill.namespace,
)
if suffix is not None:
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
msg = _(f'Cannot add fill function to "{fill.target}" only '
f'for the suffix "{suffix}" in {xmlfiles}')
raise DictConsistencyError(msg, 26)
# get the target variable
variable = self.objectspace.paths.get_variable(fill.target)
# create an object value # create an object value
value = self.objectspace.value(fill.xmlfiles) value = self.objectspace.value(fill.xmlfiles)
value.type = 'calculation' value.type = 'calculation'
value.name = fill.name value.name = fill.name
if variable.namespace == 'services': if target.name.namespace == 'services':
variable.default = value target.name.default = value
else: else:
variable.value = [value] target.name.value = [value]
# manage params # manage params
if not hasattr(fill, 'param'): if hasattr(fill, 'param') and fill.param:
continue
self.convert_fill_param(fill)
if fill.param:
value.param = fill.param value.param = fill.param
def convert_fill_param(self,
fill: "self.objectspace.fill",
) -> None:
""" valid and convert fill's param
"""
param_to_delete = []
for param_idx, param in enumerate(fill.param):
if param.type == 'string' and not hasattr(param, 'text'):
param.text = None
if param.type == 'suffix':
if hasattr(param, 'text'):
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
msg = _(f'"{param.type}" variables must not have a value in order '
f'to calculate "{fill.target}" in {xmlfiles}')
raise DictConsistencyError(msg, 28)
if not self.objectspace.paths.variable_is_dynamic(fill.target):
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
msg = _('Cannot set suffix target to the none dynamic variable '
f'"{fill.target}" in {xmlfiles}')
raise DictConsistencyError(msg, 53)
elif not hasattr(param, 'text'):
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
msg = _(f'All "{param.type}" variables must have a value in order '
f'to calculate "{fill.target}" in {xmlfiles}')
raise DictConsistencyError(msg, 27)
if param.type == 'variable':
try:
path, suffix = self.objectspace.paths.get_variable_path(param.text,
fill.namespace,
)
param.text = self.objectspace.paths.get_variable(path)
if suffix:
param.suffix = suffix
family_path = self.objectspace.paths.get_variable_family_path(path)
param.family = self.objectspace.paths.get_family(family_path,
param.text.namespace,
)
except DictConsistencyError as err:
if err.errno != 42 or not param.optional:
raise err
param_to_delete.append(param_idx)
param_to_delete.sort(reverse=True)
for param_idx in param_to_delete:
fill.param.pop(param_idx)

View File

@ -83,11 +83,9 @@ class GroupAnnotator:
# no more follower # no more follower
break break
else: else:
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
joined = '", "'.join(follower_names) joined = '", "'.join(follower_names)
msg = _(f'when parsing leadership, we espect to find those followers "{joined}" ' msg = _(f'when parsing leadership, we espect to find those followers "{joined}"')
f'in {xmlfiles}') raise DictConsistencyError(msg, 31, variable.xmlfiles)
raise DictConsistencyError(msg, 31)
del self.objectspace.space.constraints.group del self.objectspace.space.constraints.group
def manage_leader(self, def manage_leader(self,
@ -98,9 +96,8 @@ class GroupAnnotator:
"""manage leader's variable """manage leader's variable
""" """
if variable.multi is not True: if variable.multi is not True:
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles) msg = _(f'the variable "{variable.name}" in a group must be multi')
msg = _(f'the variable "{variable.name}" in a group must be multi in {xmlfiles}') raise DictConsistencyError(msg, 32, variable.xmlfiles)
raise DictConsistencyError(msg, 32)
if hasattr(group, 'name'): if hasattr(group, 'name'):
leadership_name = group.name leadership_name = group.name
else: else:
@ -145,10 +142,9 @@ class GroupAnnotator:
"""manage follower """manage follower
""" """
if variable.name != follower_name: if variable.name != follower_name:
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
msg = _('when parsing leadership, we expect to find the follower ' msg = _('when parsing leadership, we expect to find the follower '
f'"{follower_name}" but we found "{variable.name}" in {xmlfiles}') f'"{follower_name}" but we found "{variable.name}"')
raise DictConsistencyError(msg, 33) raise DictConsistencyError(msg, 33, variable.xmlfiles)
self.objectspace.paths.set_leader(variable.namespace, self.objectspace.paths.set_leader(variable.namespace,
leader_family_name, leader_family_name,
leader_space.name, leader_space.name,

View File

@ -0,0 +1,74 @@
"""Param annotator
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
from ..i18n import _
from ..error import DictConsistencyError
class ParamAnnotator:
def convert_param(self, objects) -> None:
""" valid and convert param
"""
for obj in objects:
if not hasattr(obj, 'param'):
continue
param_to_delete = []
for param_idx, param in enumerate(obj.param):
if param.type == 'suffix':
if hasattr(param, 'text'):
msg = _(f'"{param.type}" parameter must not have a value')
raise DictConsistencyError(msg, 28, obj.xmlfiles)
for target in obj.target:
if not self.objectspace.paths.variable_is_dynamic(target.name.path):
msg = _(f'"suffix" parameter cannot be set with target "{target.name}"'
f' which is not a dynamic variable')
raise DictConsistencyError(msg, 53, obj.xmlfiles)
elif not hasattr(param, 'text'):
if not param.type == 'nil':
msg = _(f'"{param.type}" parameter must have a value')
raise DictConsistencyError(msg, 27, obj.xmlfiles)
elif param.type == 'nil':
msg = _(f'"{param.type}" parameter must not have a value')
raise DictConsistencyError(msg, 40, obj.xmlfiles)
if param.type == 'variable':
try:
path, suffix = self.objectspace.paths.get_variable_path(param.text,
obj.namespace,
)
param.text = self.objectspace.paths.get_variable(path)
if suffix:
param.suffix = suffix
family_path = self.objectspace.paths.get_variable_family_path(path)
param.family = self.objectspace.paths.get_family(family_path,
param.text.namespace,
)
except DictConsistencyError as err:
if err.errno != 42 or not param.optional:
raise err
param_to_delete.append(param_idx)
param_to_delete.sort(reverse=True)
for param_idx in param_to_delete:
obj.param.pop(param_idx)

View File

@ -71,10 +71,9 @@ class PropertyAnnotator:
if 'force_store_value' in variable.properties and \ if 'force_store_value' in variable.properties and \
'force_default_on_freeze' in variable.properties: # pragma: no cover 'force_default_on_freeze' in variable.properties: # pragma: no cover
# should not appened # should not appened
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
msg = _('cannot have auto_freeze or auto_store with the hidden ' msg = _('cannot have auto_freeze or auto_store with the hidden '
f'variable "{variable.name}" in {xmlfiles}') f'variable "{variable.name}"')
raise DictConsistencyError(msg, 50) raise DictConsistencyError(msg, 50, variable.xmlfiles)
if not variable.properties: if not variable.properties:
del variable.properties del variable.properties

View File

@ -33,7 +33,7 @@ from ..error import DictConsistencyError
# a CreoleObjSpace's attribute has some annotations # a CreoleObjSpace's attribute has some annotations
# that shall not be present in the exported (flatened) XML # that shall not be present in the exported (flatened) XML
ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace', ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace',
'remove_condition', 'path', 'instance_mode', 'index', 'is_in_leadership', 'remove_condition', 'path', 'instance_mode', 'index',
'level', 'remove_fill', 'xmlfiles', 'type', 'reflector_name', 'level', 'remove_fill', 'xmlfiles', 'type', 'reflector_name',
'reflector_object', 'manage') 'reflector_object', 'manage')
@ -252,7 +252,6 @@ class ServiceAnnotator:
if not hasattr(file_, 'source'): if not hasattr(file_, 'source'):
file_.source = basename(file_.name) file_.source = basename(file_.name)
elif not hasattr(file_, 'source'): elif not hasattr(file_, 'source'):
xmlfiles = self.objectspace.display_xmlfiles(file_.xmlfiles)
msg = _(f'attribute "source" is mandatory for the file "{file_.name}" ' msg = _(f'attribute "source" is mandatory for the file "{file_.name}" '
f'"({service_name})" in {xmlfiles}') f'"({service_name})"')
raise DictConsistencyError(msg, 34) raise DictConsistencyError(msg, 34, file_.xmlfiles)

View File

@ -0,0 +1,82 @@
"""Target annotator
Created by:
EOLE (http://eole.orion.education.fr)
Copyright (C) 2005-2018
Forked by:
Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
distribued with GPL-2 or later license
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
from ..i18n import _
from ..error import DictConsistencyError
class TargetAnnotator:
def convert_target(self,
objects,
) -> None:
""" valid and convert param
"""
targets = []
for obj in objects:
if not hasattr(obj, 'target'):
msg = _('target is mandatory')
raise DictConsistencyError(msg, 9, obj.xmlfiles)
remove_targets = []
for index, target in enumerate(obj.target):
# test if it's redefined calculation
if self.target_is_uniq and target.name in targets:
msg = _(f'A fill already exists for the target of "{target.name}" created')
raise DictConsistencyError(msg, 24, obj.xmlfiles)
targets.append(target.name)
# let's replace the target by the path
try:
if target.type == 'variable':
path, suffix = self.objectspace.paths.get_variable_path(target.name,
obj.namespace,
)
target.name = self.objectspace.paths.get_variable(path)
if suffix:
msg = _(f'target to {target.name.path} with suffix is not allowed')
raise DictConsistencyError(msg, 35, obj.xmlfiles)
elif self.only_variable:
msg = _(f'target to "{target.name}" with param type "{target.type}" '
f'is not allowed')
raise DictConsistencyError(msg, 2, obj.xmlfiles)
if target.type == 'family':
target.name = self.objectspace.paths.get_family(target.name,
obj.namespace,
)
elif target.type.endswith('list') and \
obj.name not in ['disabled_if_in', 'disabled_if_not_in']:
msg = _(f'target "{target.type}" not allow')
raise DictConsistencyError(msg, 10, target.xmlfiles)
except DictConsistencyError as err:
if err.errno != 42:
raise err
# for optional variable
if not target.optional:
msg = f'cannot found target "{target.name}"'
raise DictConsistencyError(_(msg), 12, target.xmlfiles) from err
remove_targets.append(index)
remove_targets.sort(reverse=True)
for index in remove_targets:
obj.target.pop(index)

View File

@ -147,7 +147,9 @@ class VariableAnnotator: # pylint: disable=R0903
self.objectspace.space.constraints.check = [] self.objectspace.space.constraints.check = []
check = self.objectspace.check(variable.xmlfiles) check = self.objectspace.check(variable.xmlfiles)
check.name = 'valid_enum' check.name = 'valid_enum'
check.target = variable.path target = self.objectspace.target(variable.xmlfiles)
target.name = variable.path
check.target = [target]
check.namespace = namespace check.namespace = namespace
check.param = [] check.param = []
for value in FORCE_CHOICE[variable.type]: for value in FORCE_CHOICE[variable.type]:

View File

@ -112,16 +112,14 @@
<!ELEMENT constraints ((fill* | check* | condition* | group*)*)> <!ELEMENT constraints ((fill* | check* | condition* | group*)*)>
<!ELEMENT fill (param*)> <!ELEMENT fill ((target|param)+)>
<!ATTLIST fill name CDATA #REQUIRED> <!ATTLIST fill name CDATA #REQUIRED>
<!ATTLIST fill target CDATA #REQUIRED>
<!ELEMENT check (param*)> <!ELEMENT check ((target|param)+)>
<!ATTLIST check name CDATA #REQUIRED> <!ATTLIST check name CDATA #REQUIRED>
<!ATTLIST check target CDATA #REQUIRED>
<!ATTLIST check level (error|warning) "error"> <!ATTLIST check level (error|warning) "error">
<!ELEMENT condition ((target | param)+ )> <!ELEMENT condition ((target|param)+)>
<!ATTLIST condition name (disabled_if_in|disabled_if_not_in|hidden_if_in|hidden_if_not_in|mandatory_if_in|mandatory_if_not_in) #REQUIRED> <!ATTLIST condition name (disabled_if_in|disabled_if_not_in|hidden_if_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">
@ -129,7 +127,7 @@
<!ATTLIST condition force_inverse_condition_on_fallback (True|False) "False"> <!ATTLIST condition force_inverse_condition_on_fallback (True|False) "False">
<!ELEMENT param (#PCDATA)> <!ELEMENT param (#PCDATA)>
<!ATTLIST param type (string|number|variable|information|suffix) "string"> <!ATTLIST param type (string|number|nil|variable|information|suffix) "string">
<!ATTLIST param name CDATA #IMPLIED> <!ATTLIST param name CDATA #IMPLIED>
<!ATTLIST param propertyerror (True|False) "True"> <!ATTLIST param propertyerror (True|False) "True">
<!ATTLIST param optional (True|False) "False"> <!ATTLIST param optional (True|False) "False">

View File

@ -24,6 +24,17 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from .i18n import _
def display_xmlfiles(xmlfiles: list) -> str:
"""The function format xmlfiles informations to generate errors
"""
if len(xmlfiles) == 1:
return '"' + xmlfiles[0] + '"'
return '"' + '", "'.join(xmlfiles[:-1]) + '"' + ' and ' + '"' + xmlfiles[-1] + '"'
class ConfigError(Exception): class ConfigError(Exception):
"""Standard error for templating """Standard error for templating
""" """
@ -54,6 +65,8 @@ class DictConsistencyError(Exception):
"""It's not only that the Creole XML is valid against the Creole DTD """It's not only that the Creole XML is valid against the Creole DTD
it's that it is not consistent. it's that it is not consistent.
""" """
def __init__(self, msg, errno): def __init__(self, msg, errno, xmlfiles):
if xmlfiles:
msg = _(f'{msg} in {display_xmlfiles(xmlfiles)}')
super().__init__(msg) super().__init__(msg)
self.errno = errno self.errno = errno

View File

@ -149,14 +149,6 @@ class RougailObjSpace:
name = name[:-1] name = name[:-1]
return name return name
@staticmethod
def display_xmlfiles(xmlfiles: list) -> str:
"""The function format xmlfiles informations to generate errors
"""
if len(xmlfiles) == 1:
return '"' + xmlfiles[0] + '"'
return '"' + '", "'.join(xmlfiles[:-1]) + '"' + ' and ' + '"' + xmlfiles[-1] + '"'
def xml_parse_document(self, def xml_parse_document(self,
xmlfile, xmlfile,
document, document,
@ -166,8 +158,8 @@ class RougailObjSpace:
"""Parses a Rougail XML file and populates the RougailObjSpace """Parses a Rougail XML file and populates the RougailObjSpace
""" """
if namespace in ['services', Config['variable_namespace']]: if namespace in ['services', Config['variable_namespace']]:
msg = _(f'Namespace name "{namespace}" is not allowed in "{xmlfile}"') msg = _(f'Namespace name "{namespace}" is not allowed')
raise DictConsistencyError(msg, 21) raise DictConsistencyError(msg, 21, xmlfile)
if not namespace: if not namespace:
namespace = Config['variable_namespace'] namespace = Config['variable_namespace']
redefine_variables = [] redefine_variables = []
@ -193,8 +185,8 @@ class RougailObjSpace:
continue continue
if child.tag == 'family': if child.tag == 'family':
if child.attrib['name'] in family_names: if child.attrib['name'] in family_names:
msg = _(f'Family "{child.attrib["name"]}" is set several times in "{xmlfile}"') msg = _(f'Family "{child.attrib["name"]}" is set several times')
raise DictConsistencyError(msg, 44) raise DictConsistencyError(msg, 44, xmlfile)
family_names.append(child.attrib['name']) family_names.append(child.attrib['name'])
try: try:
# variable objects creation # variable objects creation
@ -309,10 +301,9 @@ class RougailObjSpace:
exists = self.convert_boolean(subspace.get('exists', True)) exists = self.convert_boolean(subspace.get('exists', True))
if exists is False: if exists is False:
raise SpaceObjShallNotBeUpdated() raise SpaceObjShallNotBeUpdated()
xmlfiles = self.display_xmlfiles(existed_var.xmlfiles)
msg = _(f'"{child.tag}" named "{name}" cannot be re-created in "{xmlfile}", ' msg = _(f'"{child.tag}" named "{name}" cannot be re-created in "{xmlfile}", '
f'already defined in {xmlfiles}') f'already defined')
raise DictConsistencyError(msg, 45) raise DictConsistencyError(msg, 45, existed_var.xmlfiles)
# object deos not exists # object deos not exists
exists = self.convert_boolean(subspace.get('exists', False)) exists = self.convert_boolean(subspace.get('exists', False))
if exists is True: if exists is True:
@ -321,8 +312,8 @@ class RougailObjSpace:
redefine = self.convert_boolean(subspace.get('redefine', False)) redefine = self.convert_boolean(subspace.get('redefine', False))
if redefine is True: if redefine is True:
# cannot redefine an inexistant object # cannot redefine an inexistant object
msg = _(f'Redefined object in "{xmlfile}": "{name}" does not exist yet') msg = _(f'Redefined object: "{name}" does not exist yet')
raise DictConsistencyError(msg, 46) raise DictConsistencyError(msg, 46, xmlfile)
if child.tag not in vars(space): if child.tag not in vars(space):
setattr(space, child.tag, {}) setattr(space, child.tag, {})
return getattr(self, child.tag)(xmlfile, name) return getattr(self, child.tag)(xmlfile, name)
@ -344,10 +335,9 @@ class RougailObjSpace:
return None return None
old_family_name = self.paths.get_variable_family_path(name) old_family_name = self.paths.get_variable_family_path(name)
if space.path != old_family_name: if space.path != old_family_name:
xmlfiles = self.display_xmlfiles(space.xmlfiles)
msg = _(f'Variable was previously create in family "{old_family_name}", ' msg = _(f'Variable was previously create in family "{old_family_name}", '
f'now it is in "{space.path}" in {xmlfiles}') f'now it is in "{space.path}"')
raise DictConsistencyError(msg, 47) raise DictConsistencyError(msg, 47, space.xmlfiles)
return self.paths.get_variable(name) return self.paths.get_variable(name)
# it's not a family # it's not a family
children = getattr(space, child.tag, {}) children = getattr(space, child.tag, {})
@ -392,10 +382,9 @@ class RougailObjSpace:
del variableobj.value del variableobj.value
for attr, val in child.attrib.items(): for attr, val in child.attrib.items():
if redefine and attr in UNREDEFINABLE: if redefine and attr in UNREDEFINABLE:
xmlfiles = self.display_xmlfiles(variableobj.xmlfiles[:-1])
msg = _(f'cannot redefine attribute "{attr}" for variable "{child.attrib["name"]}"' msg = _(f'cannot redefine attribute "{attr}" for variable "{child.attrib["name"]}"'
f' in "{xmlfile}", already defined in {xmlfiles}') f' in "{xmlfile}", already defined')
raise DictConsistencyError(msg, 48) raise DictConsistencyError(msg, 48, variableobj.xmlfiles[:-1])
if attr in self.booleans_attributs: if attr in self.booleans_attributs:
val = self.convert_boolean(val) val = self.convert_boolean(val)
if attr == 'name' and getattr(variableobj, 'name', None): if attr == 'name' and getattr(variableobj, 'name', None):
@ -417,15 +406,18 @@ class RougailObjSpace:
self.remove_condition(variableobj.name) self.remove_condition(variableobj.name)
if child.attrib.get('remove_fill', False): if child.attrib.get('remove_fill', False):
self.remove_fill(variableobj.name) self.remove_fill(variableobj.name)
if child.tag == 'fill' and child.attrib['target'] in redefine_variables: if child.tag == 'fill':
self.remove_fill(child.attrib['target']) for target in child:
if target.tag == 'target' and target.text in redefine_variables:
self.remove_fill(target.text)
def remove_check(self, name): def remove_check(self, name):
"""Remove a check with a specified target """Remove a check with a specified target
""" """
remove_checks = [] remove_checks = []
for idx, check in enumerate(self.space.constraints.check): # pylint: disable=E1101 for idx, check in enumerate(self.space.constraints.check): # pylint: disable=E1101
if check.target == name: for target in check.target:
if target.name == name:
remove_checks.append(idx) remove_checks.append(idx)
remove_checks.sort(reverse=True) remove_checks.sort(reverse=True)
for idx in remove_checks: for idx in remove_checks:
@ -451,7 +443,8 @@ class RougailObjSpace:
""" """
remove_fills = [] remove_fills = []
for idx, fill in enumerate(self.space.constraints.fill): # pylint: disable=E1101 for idx, fill in enumerate(self.space.constraints.fill): # pylint: disable=E1101
if fill.target == name: for target in fill.target:
if target.name == name:
remove_fills.append(idx) remove_fills.append(idx)
remove_fills.sort(reverse=True) remove_fills.sort(reverse=True)
for idx in remove_fills: for idx in remove_fills:

View File

@ -56,11 +56,11 @@ class Path:
else: else:
if '.' not in name: # pragma: no cover if '.' not in name: # pragma: no cover
msg = _(f'Variable "{name}" in namespace "{namespace}" must have dot') msg = _(f'Variable "{name}" in namespace "{namespace}" must have dot')
raise DictConsistencyError(msg, 39) raise DictConsistencyError(msg, 39, variableobj.xmlfiles)
full_name = name full_name = name
if full_name in self.families and \ if full_name in self.families and \
self.families[full_name]['variableobj'] != variableobj: # pragma: no cover self.families[full_name]['variableobj'] != variableobj: # pragma: no cover
raise DictConsistencyError(_(f'Duplicate family name "{name}"'), 37) raise DictConsistencyError(_(f'Duplicate family name "{name}"'), 37, variableobj.xmlfiles)
self.families[full_name] = dict(name=name, self.families[full_name] = dict(name=name,
namespace=namespace, namespace=namespace,
variableobj=variableobj, variableobj=variableobj,
@ -90,13 +90,13 @@ class Path:
if name not in self.families and name in self.full_paths_families: if name not in self.families and name in self.full_paths_families:
name = self.full_paths_families[name] name = self.full_paths_families[name]
if name not in self.families: if name not in self.families:
raise DictConsistencyError(_('unknown option {}').format(name), 42) raise DictConsistencyError(_(f'unknown option {name}'), 42, [])
dico = self.families[name] dico = self.families[name]
if current_namespace not in [Config['variable_namespace'], 'services'] and \ if current_namespace not in [Config['variable_namespace'], 'services'] and \
current_namespace != dico['namespace']: current_namespace != dico['namespace']:
msg = _(f'A family located in the "{dico["namespace"]}" namespace ' msg = _(f'A family located in the "{dico["namespace"]}" namespace '
f'shall not be used in the "{current_namespace}" namespace') f'shall not be used in the "{current_namespace}" namespace')
raise DictConsistencyError(msg, 38) raise DictConsistencyError(msg, 38, [])
return dico['variableobj'] return dico['variableobj']
# Leadership # Leadership
@ -119,11 +119,6 @@ class Path:
if namespace == Config['variable_namespace']: if namespace == Config['variable_namespace']:
self.full_paths_variables[name] = new_path self.full_paths_variables[name] = new_path
def is_in_leadership(self, name):
"""Is the variable is in a leadership
"""
return self._get_variable(name)['leader'] is not None
def is_leader(self, path): # pylint: disable=C0111 def is_leader(self, path): # pylint: disable=C0111
"""Is the variable is a leader """Is the variable is a leader
""" """
@ -164,7 +159,7 @@ class Path:
""" """
variable, suffix = self._get_variable(name, with_suffix=True) variable, suffix = self._get_variable(name, with_suffix=True)
if suffix: if suffix:
raise DictConsistencyError(_(f"{name} is a dynamic variable"), 36) raise DictConsistencyError(_(f"{name} is a dynamic variable"), 36, [])
return variable['variableobj'] return variable['variableobj']
def get_variable_family_path(self, def get_variable_family_path(self,
@ -188,7 +183,7 @@ class Path:
current_namespace != namespace: current_namespace != namespace:
msg = _(f'A variable located in the "{namespace}" namespace shall not be used ' msg = _(f'A variable located in the "{namespace}" namespace shall not be used '
f'in the "{current_namespace}" namespace') f'in the "{current_namespace}" namespace')
raise DictConsistencyError(msg, 41) raise DictConsistencyError(msg, 41, [])
return dico['variableobj'].path, suffix return dico['variableobj'].path, suffix
def path_is_defined(self, def path_is_defined(self,
@ -222,7 +217,7 @@ class Path:
if variable['is_dynamic']: if variable['is_dynamic']:
return variable, name[len(var_name):] return variable, name[len(var_name):]
if name not in self.variables: if name not in self.variables:
raise DictConsistencyError(_('unknown option {}').format(name), 42) raise DictConsistencyError(_(f'unknown option {name}'), 42, [])
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

@ -203,21 +203,31 @@ class Common:
) -> None: ) -> None:
"""Change properties to string """Change properties to string
""" """
properties = [self.convert_str(property_) for property_ in values if isinstance(property_, str)] properties = [self.convert_str(property_) for property_ in values
if isinstance(property_, str)]
calc_properties = [self.calc_properties(property_) for property_ in values \ calc_properties = [self.calc_properties(property_) for property_ in values \
if isinstance(property_, self.objectspace.property_)] if isinstance(property_, self.objectspace.property_)]
return 'frozenset({' + ', '.join(sorted(properties) + calc_properties) + '})' return 'frozenset({' + ', '.join(sorted(properties) + calc_properties) + '})'
@staticmethod def calc_properties(self,
def calc_properties(child) -> str: child,
) -> str:
"""Populate properties """Populate properties
""" """
option_name = child.source.reflector_object.get() option_name = child.source.reflector_object.get()
kwargs = (f"'condition': ParamOption({option_name}, todict=True), " kwargs = f"'condition': ParamOption({option_name}, todict=True), "
f"'expected': ParamValue('{child.expected}')") if child.expected is None or isinstance(child.expected, int):
kwargs += f"'expected': ParamValue({child.expected})"
elif isinstance(child.expected, str):
val = self.convert_str(child.expected)
kwargs += f"'expected': ParamValue({val})"
else:
val = child.expected.reflector_object.get()
kwargs += f"'expected': ParamOption({val})"
if child.inverse: if child.inverse:
kwargs += ", 'reverse_condition': ParamValue(True)" kwargs += ", 'reverse_condition': ParamValue(True)"
return f"Calculation(func.calc_value, Params(ParamValue('{child.name}'), kwargs={{{kwargs}}}))" return (f"Calculation(func.calc_value, Params(ParamValue('{child.name}'), "
f"kwargs={{{kwargs}}}))")
def populate_informations(self): def populate_informations(self):
"""Populate Tiramisu's informations """Populate Tiramisu's informations
@ -313,6 +323,8 @@ class Variable(Common):
return f"ParamValue({value})" return f"ParamValue({value})"
if param.type in ['number', 'boolean']: if param.type in ['number', 'boolean']:
return f'ParamValue({param.text})' return f'ParamValue({param.text})'
if param.type == 'nil':
return 'ParamValue(None)'
if param.type == 'variable': if param.type == 'variable':
return self.build_param(param, function) return self.build_param(param, function)
if param.type == 'information': if param.type == 'information':
@ -323,7 +335,7 @@ class Variable(Common):
@staticmethod @staticmethod
def build_param(param, def build_param(param,
function: str, function: str, # pylint: disable=W0613
) -> str: ) -> str:
"""build variable parameters """build variable parameters
""" """

View File

@ -62,11 +62,11 @@ class XMLReflector:
try: try:
document = parse(xmlfile) document = parse(xmlfile)
except XMLSyntaxError as err: except XMLSyntaxError as err:
raise DictConsistencyError(_(f'{xmlfile} is not an XML file: {err}'), 52) from err raise DictConsistencyError(_(f'not an XML file: {err}'), 52, xmlfile) from err
if not self.dtd.validate(document): if not self.dtd.validate(document):
dtd_error = self.dtd.error_log.filter_from_errors()[0] dtd_error = self.dtd.error_log.filter_from_errors()[0]
msg = _(f'"{xmlfile}" not a valid XML file: {dtd_error}') msg = _(f'not a valid XML file: {dtd_error}')
raise DictConsistencyError(msg, 43) raise DictConsistencyError(msg, 43, xmlfile)
return document.getroot() return document.getroot()
@staticmethod @staticmethod

View File

@ -13,7 +13,7 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_4 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"auto_freeze", "basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))}))
option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"basic"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"basic"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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

@ -13,7 +13,7 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_4 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"auto_freeze", "expert", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"auto_freeze", "expert", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))}))
option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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

@ -11,8 +11,9 @@
</family> </family>
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param>oui</param> <param>oui</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -13,7 +13,7 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"auto_freeze", "basic", "force_store_value", "frozen", "hidden", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"auto_freeze", "basic", "force_store_value", "frozen", "hidden", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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

@ -12,8 +12,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -12,7 +12,8 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -15,8 +15,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -14,7 +14,7 @@ except:
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_5 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_5 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"auto_freeze", "basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamOption(option_4)))), properties=frozenset({"auto_freeze", "basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"basic"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"basic"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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

@ -12,8 +12,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -10,8 +10,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -12,8 +12,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -10,8 +10,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -10,8 +10,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param type="number">3</param> <param type="number">3</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -12,8 +12,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param type="variable" optional="True">mode_conteneur_actif4</param> <param type="variable" optional="True">mode_conteneur_actif4</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -12,10 +12,11 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param type="variable" optional="True">mode_conteneur_actif4</param> <param type="variable" optional="True">mode_conteneur_actif4</param>
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<param type="variable" optional="True">mode_conteneur_actif3</param> <param type="variable" optional="True">mode_conteneur_actif3</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -10,17 +10,21 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param>quote'</param> <param>quote'</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
<fill name="calc_val" target="mode_conteneur_actif1"> <fill name="calc_val">
<param>quote"</param> <param>quote"</param>
<target>mode_conteneur_actif1</target>
</fill> </fill>
<fill name="calc_val" target="mode_conteneur_actif2"> <fill name="calc_val">
<param>quote"'</param> <param>quote"'</param>
<target>mode_conteneur_actif2</target>
</fill> </fill>
<fill name="calc_val" target="mode_conteneur_actif3"> <fill name="calc_val">
<param>quote"\'</param> <param>quote"\'</param>
<target>mode_conteneur_actif3</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -11,8 +11,9 @@
</family> </family>
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param>oui</param> <param>oui</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
<condition name="hidden_if_in" source="module_instancie"> <condition name="hidden_if_in" source="module_instancie">
<param>oui</param> <param>oui</param>

View File

@ -13,7 +13,7 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"auto_freeze", "basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"auto_freeze", "basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui"), 'reverse_condition': ParamValue(True)}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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,9 @@
</family> </family>
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="autosavevar"> <fill name="calc_val">
<param>oui</param> <param>oui</param>
<target>autosavevar</target>
</fill> </fill>
<condition name="hidden_if_in" source="mode_conteneur_actif"> <condition name="hidden_if_in" source="mode_conteneur_actif">
<param>oui</param> <param>oui</param>

View File

@ -13,7 +13,7 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
option_4 = StrOption(name="autosavevar", doc="autosave variable", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_4 = StrOption(name="autosavevar", doc="autosave variable", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"basic"})) option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"basic"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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

@ -10,8 +10,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="autosavevar"> <fill name="calc_val">
<param>oui</param> <param>oui</param>
<target>autosavevar</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -9,9 +9,10 @@
</family> </family>
</variables> </variables>
<constraints> <constraints>
<check name="valid_entier" target="int"> <check name="valid_entier">
<param name="mini" type="number">0</param> <param name="mini" type="number">0</param>
<param name="maxi" type="number">100</param> <param name="maxi" type="number">100</param>
<target>int</target>
</check> </check>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -10,7 +10,9 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_lower" target="int"/> <check name="valid_lower">
<target>int</target>
</check>
</constraints> </constraints>
</rougail> </rougail>
<!-- vim: ts=4 sw=4 expandtab <!-- vim: ts=4 sw=4 expandtab

View File

@ -13,9 +13,10 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_lower" target="int"> <check name="valid_lower">
<param name="mini">0</param> <param name="mini">0</param>
<param name="maxi" type="variable">int2</param> <param name="maxi" type="variable">int2</param>
<target>int</target>
</check> </check>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -11,11 +11,13 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_differ" target="int"> <check name="valid_differ">
<param type="variable" optional="True">int2</param> <param type="variable" optional="True">int2</param>
<target>int</target>
</check> </check>
<check name="valid_differ" target="int"> <check name="valid_differ">
<param type="variable" optional="True">int3</param> <param type="variable" optional="True">int3</param>
<target>int</target>
</check> </check>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -12,8 +12,9 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_differ" target="mode_conteneur_actif"> <check name="valid_differ">
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<target>mode_conteneur_actif</target>
</check> </check>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -18,8 +18,9 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ">
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<target>mode_conteneur_actif3</target>
</check> </check>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -7,11 +7,13 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ">
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<target>mode_conteneur_actif3</target>
</check> </check>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ">
<param type="variable">mode_conteneur_actif2</param> <param type="variable">mode_conteneur_actif2</param>
<target>mode_conteneur_actif3</target>
</check> </check>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -18,8 +18,9 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ">
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<target>mode_conteneur_actif3</target>
</check> </check>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -9,11 +9,13 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ">
<param type="variable">mode_conteneur_actif1</param> <param type="variable">mode_conteneur_actif1</param>
<target>mode_conteneur_actif3</target>
</check> </check>
<check name="valid_differ" target="mode_conteneur_actif3"> <check name="valid_differ">
<param type="variable">mode_conteneur_actif2</param> <param type="variable">mode_conteneur_actif2</param>
<target>mode_conteneur_actif3</target>
</check> </check>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -12,9 +12,10 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_in_network" target="adresse_ip" level="warning"> <check name="valid_in_network" level="warning">
<param type="variable">adresse_ip_eth0</param> <param type="variable">adresse_ip_eth0</param>
<param type="variable">adresse_netmask_eth0</param> <param type="variable">adresse_netmask_eth0</param>
<target>adresse_ip</target>
</check> </check>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -11,8 +11,9 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_in_network" target="adresse_ip" level="warning"> <check name="valid_in_network" level="warning">
<param type="variable">adresse_ip_eth0</param> <param type="variable">adresse_ip_eth0</param>
<target>adresse_ip</target>
</check> </check>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -11,8 +11,9 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_ipnetmask" target="adresse_netmask_eth0" level="warning"> <check name="valid_ipnetmask" level="warning">
<param type="variable">adresse_ip_eth0</param> <param type="variable">adresse_ip_eth0</param>
<target>adresse_netmask_eth0</target>
</check> </check>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -7,8 +7,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param type="information">test_information</param> <param type="information">test_information</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -13,10 +13,11 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_enum" target="enumvar"> <check name="valid_enum">
<param>1</param> <param>1</param>
<param>2</param> <param>2</param>
<param>3</param> <param>3</param>
<target>enumvar</target>
</check> </check>
<condition name="hidden_if_in" source="enumvar"> <condition name="hidden_if_in" source="enumvar">
<param>4</param> <param>4</param>

View File

@ -14,11 +14,13 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="follower1"> <fill name="calc_val">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>follower1</target>
</fill> </fill>
<fill name="calc_val" target="follower2"> <fill name="calc_val">
<param type="variable">follower1</param> <param type="variable">follower1</param>
<target>follower2</target>
</fill> </fill>
<group leader="leader"> <group leader="leader">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -14,11 +14,13 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="follower1"> <fill name="calc_val">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>follower1</target>
</fill> </fill>
<fill name="calc_val" target="follower2"> <fill name="calc_val">
<param type="variable">follower1</param> <param type="variable">follower1</param>
<target>follower2</target>
</fill> </fill>
<group leader="leader"> <group leader="leader">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -14,11 +14,13 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="follower1"> <fill name="calc_val">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>follower1</target>
</fill> </fill>
<fill name="calc_val" target="follower2"> <fill name="calc_val">
<param type="variable">follower1</param> <param type="variable">follower1</param>
<target>follower2</target>
</fill> </fill>
<group leader="leader" name="leadership"> <group leader="leader" name="leadership">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -13,14 +13,17 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="follower1"> <fill name="calc_val">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>follower1</target>
</fill> </fill>
<fill name="calc_val" target="follower2"> <fill name="calc_val">
<param type="variable">follower1</param> <param type="variable">follower1</param>
<target>follower2</target>
</fill> </fill>
<fill name="calc_val" target="follower3"> <fill name="calc_val">
<param type="variable">leader</param> <param type="variable">leader</param>
<target>follower3</target>
</fill> </fill>
<group leader="leader"> <group leader="leader">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -12,11 +12,13 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="follower1"> <fill name="calc_val">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>follower1</target>
</fill> </fill>
<fill name="calc_val" target="follower2"> <fill name="calc_val">
<param type="variable">leader</param> <param type="variable">leader</param>
<target>follower2</target>
</fill> </fill>
<group leader="leader"> <group leader="leader">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -14,8 +14,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_list" target="leader"> <fill name="calc_list">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>leader</target>
</fill> </fill>
<group leader="leader"> <group leader="leader">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -12,11 +12,13 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="follower1"> <fill name="calc_val">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>follower1</target>
</fill> </fill>
<fill name="calc_val" target="follower2"> <fill name="calc_val">
<param type="variable">follower1</param> <param type="variable">follower1</param>
<target>follower2</target>
</fill> </fill>
<group leader="leader"> <group leader="leader">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -12,11 +12,13 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="follower1"> <fill name="calc_val">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>follower1</target>
</fill> </fill>
<fill name="calc_val" target="follower2"> <fill name="calc_val">
<param type="variable">follower1</param> <param type="variable">follower1</param>
<target>follower2</target>
</fill> </fill>
<group leader="leader"> <group leader="leader">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -14,8 +14,9 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_list" target="leader"> <fill name="calc_list">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>leader</target>
</fill> </fill>
<group leader="leader"> <group leader="leader">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -14,10 +14,10 @@ except:
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"}))
option_6 = StrOption(name="leader", doc="leader", multi=True, properties=frozenset({Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))})) option_6 = StrOption(name="leader", doc="leader", multi=True, properties=frozenset({Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))})) option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))})) option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))})) option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
option_4 = OptionDescription(name="leadermode", doc="leadermode", children=[option_5], properties=frozenset({"normal"})) option_4 = OptionDescription(name="leadermode", doc="leadermode", children=[option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) option_1 = OptionDescription(name="rougail", doc="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

@ -14,10 +14,10 @@ except:
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"}))
option_6 = StrOption(name="leader", doc="leader", multi=True, properties=frozenset({Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))})) option_6 = StrOption(name="leader", doc="leader", multi=True, properties=frozenset({Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))})) option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))})) option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
option_5 = Leadership(name="other", doc="other", children=[option_6, option_7, option_8], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('non')}))})) option_5 = Leadership(name="other", doc="other", children=[option_6, option_7, option_8], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
option_4 = OptionDescription(name="leadermode", doc="leadermode", children=[option_5], properties=frozenset({"normal"})) option_4 = OptionDescription(name="leadermode", doc="leadermode", children=[option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) option_1 = OptionDescription(name="rougail", doc="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

@ -12,11 +12,13 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="follower1"> <fill name="calc_val">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>follower1</target>
</fill> </fill>
<fill name="calc_val" target="follower2"> <fill name="calc_val">
<param type="variable">follower1</param> <param type="variable">follower1</param>
<target>follower2</target>
</fill> </fill>
<group leader="leader"> <group leader="leader">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -12,11 +12,13 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="follower1"> <fill name="calc_val">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>follower1</target>
</fill> </fill>
<fill name="calc_val" target="follower2"> <fill name="calc_val">
<param type="variable">follower1</param> <param type="variable">follower1</param>
<target>follower2</target>
</fill> </fill>
<group leader="leader"> <group leader="leader">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -17,11 +17,13 @@
</variables> </variables>
<constraints> <constraints>
<fill name="calc_val" target="follower1"> <fill name="calc_val">
<param name="valeur">valfill</param> <param name="valeur">valfill</param>
<target>follower1</target>
</fill> </fill>
<fill name="calc_val" target="follower2"> <fill name="calc_val">
<param type="variable">follower1</param> <param type="variable">follower1</param>
<target>follower2</target>
</fill> </fill>
<group leader="leader"> <group leader="leader">
<follower>follower1</follower> <follower>follower1</follower>

View File

@ -13,8 +13,8 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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

@ -15,8 +15,9 @@
<param>no</param> <param>no</param>
<target type="variable">variable1</target> <target type="variable">variable1</target>
</condition> </condition>
<fill name="calc_val" target="variable2"> <fill name="calc_val">
<param type="variable" propertyerror="False">variable1</param> <param type="variable" propertyerror="False">variable1</param>
<target>variable2</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -13,7 +13,7 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="variable1", doc="variable1", properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('no')}))})) option_4 = StrOption(name="variable1", doc="variable1", properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("no")}))}))
option_5 = StrOption(name="variable2", doc="variable2", default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=True)))), properties=frozenset({"normal"})) option_5 = StrOption(name="variable2", doc="variable2", default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=True)))), properties=frozenset({"normal"}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])

View File

@ -13,8 +13,8 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('maybe')}))})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('maybe')}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_10 = StrOption(name="group", doc="group", default="root") option_10 = StrOption(name="group", doc="group", default="root")

View File

@ -14,7 +14,7 @@ except:
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('yes')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('maybe')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('yes')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('maybe')}))})) option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_10 = StrOption(name="group", doc="group", default="root") option_10 = StrOption(name="group", doc="group", default="root")

View File

@ -14,7 +14,7 @@ except:
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('yes'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('maybe'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('yes')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('maybe')}))})) option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_10 = StrOption(name="group", doc="group", default="root") option_10 = StrOption(name="group", doc="group", default="root")

View File

@ -14,7 +14,7 @@ except:
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('yes'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('maybe'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('yes')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('maybe')}))})) option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_10 = StrOption(name="group", doc="group", default="root") option_10 = StrOption(name="group", doc="group", default="root")

View File

@ -14,7 +14,7 @@ except:
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="condition2", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition2", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('yes'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('maybe'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('yes')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('maybe')}))})) option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_10 = StrOption(name="group", doc="group", default="root") option_10 = StrOption(name="group", doc="group", default="root")

View File

@ -14,7 +14,7 @@ except:
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="condition2", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"})) option_4 = StrOption(name="condition2", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('yes'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('maybe'), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('yes')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('maybe')}))})) option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_10 = StrOption(name="group", doc="group", default="root") option_10 = StrOption(name="group", doc="group", default="root")

View File

@ -13,8 +13,8 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('maybe')}))})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('maybe')}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_10 = StrOption(name="group", doc="group", default="root") option_10 = StrOption(name="group", doc="group", default="root")

View File

@ -16,7 +16,7 @@
<constraints> <constraints>
<condition name="disabled_if_in" source="condition"> <condition name="disabled_if_in" source="condition">
<param/> <param type="nil"/>
<target type="variable">mode_conteneur_actif</target> <target type="variable">mode_conteneur_actif</target>
<target type="variable">mode_conteneur_actif2</target> <target type="variable">mode_conteneur_actif2</target>
<target type="filelist">afilllist</target> <target type="filelist">afilllist</target>

View File

@ -13,8 +13,8 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('None')}))})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(None)}))}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('None')}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(None)}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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,34 @@
<?xml version="1.0" encoding="utf-8"?>
<rougail>
<variables>
<family name='general'>
<variable name='condition' type='string' description="No change">
<value>tous</value>
</variable>
<variable name='mode_conteneur_actif' type='string' description="No change">
<value>tous</value>
</variable>
<variable name='mode_conteneur_actif2' type='string' description="No change">
<value>non</value>
</variable>
</family>
</variables>
<constraints>
<check name="valid_enum">
<param>tous</param>
<param>authentifié</param>
<param>aucun</param>
<target>condition</target>
</check>
<condition name='disabled_if_in' source='condition'>
<param type="variable">mode_conteneur_actif</param>
<target type='variable'>mode_conteneur_actif2</target>
</condition>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

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

View File

@ -0,0 +1,20 @@
from importlib.machinery import SourceFileLoader
from importlib.util import spec_from_loader, module_from_spec
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
spec = spec_from_loader(loader.name, loader)
func = module_from_spec(spec)
loader.exec_module(func)
for key, value in dict(locals()).items():
if key != ['SourceFileLoader', 'func']:
setattr(func, key, value)
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="tous", properties=frozenset({"mandatory", "normal"}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamOption(option_4)}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<rougail>
<variables>
<family name='general'>
<variable name='condition' type='string' description="No change">
<value>tous</value>
</variable>
<variable name='mode_conteneur_actif' type='string' description="No change">
<value>aucun</value>
</variable>
<variable name='mode_conteneur_actif2' type='string' description="No change">
<value>non</value>
</variable>
</family>
</variables>
<constraints>
<check name="valid_enum">
<param>tous</param>
<param>authentifié</param>
<param>aucun</param>
<target>condition</target>
</check>
<condition name='disabled_if_in' source='condition'>
<param type="variable">mode_conteneur_actif</param>
<target type='variable'>mode_conteneur_actif2</target>
</condition>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

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

View File

@ -0,0 +1,20 @@
from importlib.machinery import SourceFileLoader
from importlib.util import spec_from_loader, module_from_spec
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
spec = spec_from_loader(loader.name, loader)
func = module_from_spec(spec)
loader.exec_module(func)
for key, value in dict(locals()).items():
if key != ['SourceFileLoader', 'func']:
setattr(func, key, value)
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="aucun", properties=frozenset({"mandatory", "normal"}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamOption(option_4)}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])

View File

@ -13,10 +13,10 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_2 = OptionDescription(name="general", doc="Général", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="Général", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_7 = StrOption(name="mode_conteneur_actif3", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) option_7 = StrOption(name="mode_conteneur_actif3", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
option_6 = OptionDescription(name="general2", doc="Général2", children=[option_7], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_6 = OptionDescription(name="general2", doc="Général2", children=[option_7], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_6]) option_1 = OptionDescription(name="rougail", doc="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

@ -14,7 +14,7 @@ except:
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"disabled", "mandatory", "normal"})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"disabled", "mandatory", "normal"}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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

@ -13,8 +13,8 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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

@ -13,8 +13,8 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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

@ -13,8 +13,8 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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

@ -20,8 +20,9 @@
<target type="variable">mode_conteneur_actif</target> <target type="variable">mode_conteneur_actif</target>
<target type="variable">mode_conteneur_actif2</target> <target type="variable">mode_conteneur_actif2</target>
</condition> </condition>
<fill name="calc_val" target="mode_conteneur_actif"> <fill name="calc_val">
<param>non</param> <param>non</param>
<target>mode_conteneur_actif</target>
</fill> </fill>
</constraints> </constraints>
</rougail> </rougail>

View File

@ -13,8 +13,8 @@ except:
from tiramisu import * from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("non")))), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("non")))), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))})) option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) option_1 = OptionDescription(name="rougail", doc="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

@ -15,10 +15,11 @@
</variables> </variables>
<constraints> <constraints>
<check name="valid_enum" target="condition"> <check name="valid_enum">
<param>tous</param> <param>tous</param>
<param>authentifié</param> <param>authentifié</param>
<param>aucun</param> <param>aucun</param>
<target>condition</target>
</check> </check>
<condition name="hidden_if_in" source="condition"> <condition name="hidden_if_in" source="condition">
<param>tous</param> <param>tous</param>

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