Compare commits

..

13 Commits

1196 changed files with 3273 additions and 3548 deletions

5
debian/changelog vendored
View File

@ -1,5 +0,0 @@
rougail (0.1) unstable; urgency=low
* first version
-- Cadoles <contact@cadoles.com> Tue, 31 Mar 2020 10:40:42 +0200

2
debian/control vendored
View File

@ -9,6 +9,6 @@ Homepage: https://forge.cadoles.com/Infra/rougail
Package: rougail Package: rougail
Architecture: any Architecture: any
Pre-Depends: dpkg, python3, ${misc:Pre-Depends} Pre-Depends: dpkg, python3, ${misc:Pre-Depends}
Depends: ${python:Depends}, ${misc:Depends} Depends: ${python:Depends}, ${misc:Depends}, python3-cheetah
Description: configuration manager Description: configuration manager

View File

@ -1,23 +0,0 @@
Valeur automatiquement modifiée
===============================
Une variable avec valeur automatiquement modifiée est une variable dont la valeur sera considéré comme modifié quand le serveur sera déployé.
Voici un variable a valeur automatiquement modifiée :
<variable name="my_variable" type="oui/non" description="My variable" auto_save="True">
Dans ce cas la valeur est fixée à la valeur actuelle.
Par exemple, si la valeur de cette variable est issue d'un calcul, la valeur ne sera plus recalculée.
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é.
Voici un variable à valeur en lecture seule automatique :
<variable name="my_variable" type="oui/non" description="My variable" auto_freeze="True">
Dans ce cas la valeur est fixée à la valeur actuelle et elle ne sera plus modifiable par l'utilisateur.
Par exemple, si la valeur de cette variable est issue d'un calcul, la valeur ne sera plus recalculée.

View File

@ -1,277 +0,0 @@
Les variables calculées
=======================
Une variable calculée est une variable donc sa valeur est le résultat d'une fonction python.
Variable avec une valeur par défaut calculée
--------------------------------------------
Créons une variable de type "oui/non" donc la valeur est retournée par la fonction "return_no" :
<variables>
<family name="family">
<variable name="my_calculated_variable" type="oui/non" description="My calculated variable"/>
</family>
</variables>
<constraints>
<fill name="return_no" target="my_calculated_variable"/>
</constraints>
Puis créons la fonction "return_no" :
def return_no():
return 'non'
Dans ce cas, la valeur par défaut est la valeur retournée par la fonction (ici "non"), elle sera calculée tant que l'utilisateur n'a pas de spécifié une valeur à cette variable.
Si l'utilisateur à définit une valeur par défaut à "my_calculated_variable" :
<variable name="my_calculated_variable" type="oui/non" description="My calculated variable">
<value>oui</value>
</variable>
Cette valeur par défaut sera complètement ignorée.
Variable avec une valeur calculée
---------------------------------
En ajoutant le paramètre "hidden" à "True" dans la variable précédente, l'utilisateur n'aura plus la possibilité de modifié la valeur. La valeur de la variable sera donc systématiquement calculée :
<variable name="my_calculated_variable" type="oui/non" description="My calculated variable" hidden="True"/>
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 avec valeur calculée obligatoire
-----------------------------------------
Par défaut les variables calculées ne sont pas des varibles obligatoires.
Dans ce cas un calcul peut retourner None, mais surtout un utilisateur peut spécifier une valeur nulle à cette variable. Dans ce cas le calcul ne sera pas réalisé.
Fonction avec une valeur fixe comme paramètre positionnel
---------------------------------------------------------
Déclarons un calcul avec paramètre :
<constraints>
<fill name="return_value" target="my_calculated_variable">
<param>non</param>
</fill>
</constraints>
Créons la fonction correspondante :
def return_value(value):
return value
La variable aura donc "non" comme valeur puisque le paramètre aura la valeur fixe "non".
Paramètre nommée
----------------
Déclarons une contrainte avec un paramètre nommée :
<constraints>
<fill name="return_value" target="my_calculated_variable">
<param name="valeur">non</param>
</fill>
</constraints>
Dans ce cas la fonction return_value sera exécuté avec le paramètre nommé "valeur" dont sa valeur sera "non".
Paramètre avec un nombre
------------------------
Déclarons un calcul avec paramètre avec un nombre :
<constraints>
<fill name="return_value_with_number" target="my_calculated_variable">
<param type="number">1</param>
</fill>
</constraints>
Créons la fonction correspondante :
def return_value_with_number(value):
if value == 1:
return 'non'
return 'oui'
La variable aura donc "non" comme valeur puisque le paramètre aura la valeur fixe "1".
Paramètre dont la valeur est issue d'une autre variable
-------------------------------------------------------
Créons deux variables avec une contrainte de type variable qui contient le nom de la variable dont sa valeur sera utilisé comme paramètre :
<variables>
<family name="family">
<variable name="my_calculated_variable" type="oui/non" description="My calculated variable"/>
<variable name="my_variable" type="number" description="My variable">
<value>1</value>
</variable>
</family>
</variables>
<constraints>
<fill name="return_value_with_number" target="my_calculated_variable">
<param type="variable">my_variable</param>
</fill>
</constraints>
Si l'utilisateur laisse la valeur 1 à "my_variable", la valeur par défault de la variable "my_calculated_variable" sera "non".
Si la valeur de "my_variable" est différent de 1, la valeur par défaut de la variable "my_calculated_variable" sera "oui".
Paramètre dont la valeur est issue d'une information de la configuration
------------------------------------------------------------------------
Créons une variable et la contrainte :
<variables>
<family name="family">
<variable name="my_calculated_variable" type="string" description="My calculated variable"/>
</family>
</variables>
<constraints>
<fill name="return_value" target="my_calculated_variable">
<param type="information">server_name</param>
</fill>
</constraints>
Dans ce cas, l'information de la configuration "server_name" sera utilisé comme valeur de la variable "my_calculated_variable".
Si l'information n'existe pas, la paramètre aura la valeur "None".
Paramètre avec variable potentiellement non existante
-----------------------------------------------------
Suivant le contexte une variable peut exister ou ne pas exister.
Un paramètre de type "variable" peut être "optional" :
<variables>
<family name="family">
<variable name="my_calculated_variable" type="oui/non" description="My calculated variable"/>
</family>
</variables>
<constraints>
<fill name="return_value" target="my_calculated_variable">
<param type="variable" optional="True">unknow_variable</param>
</fill>
</constraints>
Dans ce cas la fonction "return_value" est exécuté sans paramètre.
Les variables suiveuses
-----------------------
FIXME :
- 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
Les variables dynamiques
------------------------
Paramètre avec variable dynamique
'''''''''''''''''''''''''''''''''
Il est possible de faire un calcul avec comme paramètre une variable dynamique mais pour une suffix particulier :
<variables>
<family name='family'>
<variable name='suffixes' type='string' description="Suffixes of dynamic family" multi="True">
<value>val1</value>
<value>val2</value>
</variable>
<variable name="my_calculated_variable" type="string" description="My calculated variable"/>
</family>
<family name='dyn' dynamic="suffixes">
<variable name='vardyn' type='string' description="Dynamic variable">
<value>val</value>
</variable>
</family>
</variables>
<constraints>
<fill name="return_value" target="my_calculated_variable">
<param type="variable">vardynval1</param>
</fill>
</constraints>
Dans ce cas, valeur du paramètre de la fonction "return_value" sera la valeur de la variable "vardyn" avec le suffix "val1".
Calcule d'une variable dynamique
''''''''''''''''''''''''''''''''
Il est également possible de calculer une variable dynamique à partir d'une variable standard :
<variables>
<family name='family'>
<variable name='suffixes' type='string' description="Suffixes of dynamic family" multi="True">
<value>val1</value>
<value>val2</value>
</variable>
<variable name="my_variable" type="string" description="My variable">
<value>val</value>
</variable>
</family>
<family name='dyn' dynamic="suffixes">
<variable name="my_calculated_variable_dyn_" type="string" description="My calculated variable"/>
<value>val</value>
</variable>
</family>
</variables>
<constraints>
<fill name="return_value" target="my_calculated_variable_dyn_">
<param type="variable">my_variable</param>
</fill>
</constraints>
Dans ce cas, les variables dynamiques "my_calculated_variable_dyn_" seront calculés à partir de la valeur de la variable "my_variable".
Que cela soit pour la variable "my_calculated_variable_dyn_val1" et "my_calculated_variable_dyn_val2".
Par contre, il n'est pas possible de faire un calcul pour une seule des deux variables issues de la variable dynamique.
Si c'est ce que vous cherchez à faire, il faudra prévoir un traitement particulier dans votre fonction.
Dans ce cas, il faut explicitement demander la valeur du suffix dans la fonction :
<constraints>
<fill name="return_value_suffix" target="my_calculated_variable_dyn_">
<param type="variable">my_variable</param>
<param type="suffix"/>
</fill>
</constraints>
Et ainsi faire un traitement spécifique pour ce suffix :
def return_value_suffix(value, suffix):
if suffix == 'val1':
return value
Redéfinition des calcules
-------------------------
Dans un premier dictionnaire déclarons notre variable et notre calcule :
<variables>
<family name="family">
<variable name="my_calculated_variable" type="oui/non" description="My calculated variable"/>
</family>
</variables>
<constraints>
<fill name="return_no" target="my_calculated_variable"/>
</constraints>
Dans un second dictionnaire il est possible de redéfinir le calcul :
<variables>
<family name="family">
<variable name="my_calculated_variable" redefine="True"/>
</family>
</variables>
<constraints>
<fill name="return_yes" target="my_calculated_variable"/>
</constraints>
Dans ce cas, à aucun moment la fonction "return_no" ne sera exécuté. Seul la fonction "return_yes" le sera.

View File

@ -1,13 +0,0 @@
Variable
========
Variable obligatoire
--------------------
Variable dont une valeur est requise :
<variables>
<family name="family">
<variable name="my_variable" type="oui/non" description="My variable" mandatory="True"/>
</family>
</variables>

View File

@ -56,6 +56,9 @@ KEY_TYPE = {'variable': 'symlink',
'URLOption': 'web_address', 'URLOption': 'web_address',
'FilenameOption': 'filename'} 'FilenameOption': 'filename'}
TYPE_PARAM_CHECK = ('string', 'python', 'variable')
TYPE_PARAM_CONDITION = ('string', 'python', 'number', 'variable')
TYPE_PARAM_FILL = ('string', 'number', 'variable')
CONVERSION = {'number': int} CONVERSION = {'number': int}
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
@ -473,11 +476,9 @@ class VariableAnnotator:
check.name = 'valid_enum' check.name = 'valid_enum'
check.target = path check.target = path
check.namespace = namespace check.namespace = namespace
check.param = []
for value in FORCE_CHOICE[variable.type]:
param = self.objectspace.param() param = self.objectspace.param()
param.text = value param.text = str(FORCE_CHOICE[variable.type])
check.param.append(param) check.param = [param]
if not hasattr(self.objectspace.space, 'constraints'): if not hasattr(self.objectspace.space, 'constraints'):
self.objectspace.space.constraints = self.objectspace.constraints() self.objectspace.space.constraints = self.objectspace.constraints()
self.objectspace.space.constraints.namespace = namespace self.objectspace.space.constraints.namespace = namespace
@ -626,6 +627,8 @@ class ConstraintAnnotator:
if hasattr(check, 'param'): if hasattr(check, 'param'):
param_option_indexes = [] param_option_indexes = []
for idx, param in enumerate(check.param): for idx, param in enumerate(check.param):
if param.type not in TYPE_PARAM_CHECK:
raise DictConsistencyError(_('cannot use {} type as a param in check for {}').format(param.type, check.target))
if param.type == 'variable' and not self.objectspace.paths.path_is_defined(param.text): if param.type == 'variable' and not self.objectspace.paths.path_is_defined(param.text):
if param.optional is True: if param.optional is True:
param_option_indexes.append(idx) param_option_indexes.append(idx)
@ -658,50 +661,55 @@ class ConstraintAnnotator:
remove_indexes = [] remove_indexes = []
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':
if len(check.param) != 1:
raise DictConsistencyError(_(f'cannot set more than one param for valid_enum for variable {check.target}'))
param = check.param[0]
if check.target in self.valid_enums: if check.target in self.valid_enums:
raise DictConsistencyError(_(f'valid_enum already set for {check.target}')) raise DictConsistencyError(_(f'valid_enum already set for {check.target}'))
if not hasattr(check, 'param'): if param.type not in ['string', 'python', 'number']:
raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable {check.target}')) raise DictConsistencyError(_(f'unknown type {param.type} for param in valid_enum for {check.target}'))
variable = self.objectspace.paths.get_variable_obj(check.target) variable = self.objectspace.paths.get_variable_obj(check.target)
values = self.load_params_in_valid_enum(check.param, values = self.load_params_in_validenum(param,
variable.name, variable.name,
variable.type, variable.type,
) )
self.valid_enums[check.target] = {'type': param.type,
'values': values}
self._set_valid_enum(variable, self._set_valid_enum(variable,
values, values,
variable.type, variable.type,
check.target
) )
remove_indexes.append(idx) remove_indexes.append(idx)
remove_indexes.sort(reverse=True) remove_indexes.sort(reverse=True)
for idx in remove_indexes: for idx in remove_indexes:
del self.objectspace.space.constraints.check[idx] del self.objectspace.space.constraints.check[idx]
def load_params_in_valid_enum(self, def load_params_in_validenum(self,
params, param,
variable_name, variable_name,
variable_type, variable_type,
): ):
has_variable = None if not hasattr(param, 'text') and (param.type == 'python' or param.type == 'number'):
values = [] raise DictConsistencyError(_(f"All '{param.type}' variables shall be set in order to calculate valid_enum for variable {variable_name}"))
for param in params: if variable_type == 'string' and param.type == 'number':
if param.type == 'variable': raise DictConsistencyError(_(f'Unconsistency valid_enum type ({param.type}), for variable {variable_name}'))
if has_variable is not None: if param.type == 'python':
raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}')) try:
has_variable = True values = eval(param.text, {'eosfunc': self.eosfunc, '__builtins__': {'range': range, 'str': str}})
variable = self.objectspace.paths.get_variable_obj(param.text) except NameError:
if not variable.multi: raise DictConsistencyError(_('The function {} is unknown').format(param.text))
raise DictConsistencyError(_(f'only multi "variable" parameter is allowed for valid_enum of variable {variable_name}'))
values = param.text
else: else:
if has_variable: try:
raise DictConsistencyError(_(f'only one "variable" parameter is allowed for valid_enum of variable {variable_name}')) values = literal_eval(param.text)
if not hasattr(param, 'text'): except ValueError:
if param.type == 'number': raise DictConsistencyError(_(f'Cannot load {param.text} in valid_enum'))
raise DictConsistencyError(_(f'value is mandatory for valid_enum of variable {variable_name}')) if not isinstance(values, list):
values.append(None) raise DictConsistencyError(_('Function {} shall return a list').format(param.text))
else: for value in values:
values.append(param.text) if variable_type == 'string' and not isinstance(value, str):
raise DictConsistencyError(_(f'Cannot load "{param.text}", "{value}" is not a string'))
if variable_type == 'number' and not isinstance(value, int):
raise DictConsistencyError(_(f'Cannot load "{param.text}", "{value}" is not a number'))
return values return values
def check_change_warning(self): def check_change_warning(self):
@ -728,6 +736,9 @@ class ConstraintAnnotator:
def check_params_target(self): def check_params_target(self):
for condition in self.objectspace.space.constraints.condition: for condition in self.objectspace.space.constraints.condition:
for param in condition.param:
if param.type not in TYPE_PARAM_CONDITION:
raise DictConsistencyError(_(f'cannot use {param.type} type as a param in a condition'))
if not hasattr(condition, 'target'): if not hasattr(condition, 'target'):
raise DictConsistencyError(_('target is mandatory in condition')) raise DictConsistencyError(_('target is mandatory in condition'))
for target in condition.target: for target in condition.target:
@ -908,28 +919,16 @@ class ConstraintAnnotator:
variable.property.append(prop) variable.property.append(prop)
del self.objectspace.space.constraints.condition del self.objectspace.space.constraints.condition
def _set_valid_enum(self, variable, values, type_, target): def _set_valid_enum(self, variable, values, type_):
# value for choice's variable is mandatory # value for choice's variable is mandatory
variable.mandatory = True variable.mandatory = True
# build choice # build choice
variable.choice = [] variable.choice = []
if isinstance(values, str):
choice = self.objectspace.choice()
choice.type = 'calculation'
choice.name = values
variable.choice.append(choice)
else:
self.valid_enums[target] = {'type': type_,
'values': values,
}
choices = [] choices = []
for value in values: for value in values:
choice = self.objectspace.choice() choice = self.objectspace.choice()
try: try:
if value is not None:
choice.name = CONVERSION.get(type_, str)(value) choice.name = CONVERSION.get(type_, str)(value)
else:
choice.name = value
except: except:
raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{value}" is not a valid "{type_}" for "{variable.name}"')) raise DictConsistencyError(_(f'unable to change type of a valid_enum entry "{value}" is not a valid "{type_}" for "{variable.name}"'))
if choice.name == '': if choice.name == '':
@ -937,6 +936,8 @@ class ConstraintAnnotator:
choices.append(choice.name) choices.append(choice.name)
choice.type = type_ choice.type = type_
variable.choice.append(choice) variable.choice.append(choice)
if not variable.choice:
raise DictConsistencyError(_('empty valid enum is not allowed for variable {}').format(variable.name))
# check value or set first choice value has default value # check value or set first choice value has default value
if hasattr(variable, 'value'): if hasattr(variable, 'value'):
for value in variable.value: for value in variable.value:
@ -949,11 +950,9 @@ class ConstraintAnnotator:
raise DictConsistencyError(_('value "{}" of variable "{}" is not in list of all expected values ({})').format(value.name, variable.name, choices)) raise DictConsistencyError(_('value "{}" of variable "{}" is not in list of all expected values ({})').format(value.name, variable.name, choices))
else: else:
new_value = self.objectspace.value() new_value = self.objectspace.value()
new_value.name = choices[0] new_value.name = values[0]
new_value.type = type_ new_value.type = type_
variable.value = [new_value] variable.value = [new_value]
if not variable.choice:
raise DictConsistencyError(_('empty valid enum is not allowed for variable {}').format(variable.name))
variable.type = 'choice' variable.type = 'choice'
def convert_check(self): def convert_check(self):
@ -1021,22 +1020,20 @@ class ConstraintAnnotator:
namespace = fill.namespace namespace = fill.namespace
# let's replace the target by the path # let's replace the target by the path
fill.target, suffix = self.objectspace.paths.get_variable_path(fill.target, fill.target = self.objectspace.paths.get_variable_path(fill.target,
namespace, namespace,
with_suffix=True,
) )
if suffix is not None:
raise DictConsistencyError(_(f'Cannot add fill function to "{fill.target}" only with the suffix "{suffix}"'))
value = self.objectspace.value() value = self.objectspace.value()
value.type = 'calculation' value.type = 'calculation'
value.name = fill.name value.name = fill.name
if hasattr(fill, 'param'): if hasattr(fill, 'param'):
param_to_delete = [] param_to_delete = []
for fill_idx, param in enumerate(fill.param): for fill_idx, param in enumerate(fill.param):
if param.type not in ['suffix', 'string'] and not hasattr(param, 'text'): if param.type not in TYPE_PARAM_FILL:
raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target}")) raise DictConsistencyError(_(f'cannot use {param.type} type as a param in a fill/auto'))
if param.type == 'suffix' and hasattr(param, 'text'): if param.type != 'string' and not hasattr(param, 'text'):
raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target}")) raise DictConsistencyError(_(f"All '{param.type}' variables shall have a value in order to calculate {fill.target}"))
if param.type == 'variable': if param.type == 'variable':
try: try:
param.text, suffix = self.objectspace.paths.get_variable_path(param.text, param.text, suffix = self.objectspace.paths.get_variable_path(param.text,
@ -1139,9 +1136,9 @@ class FamilyAnnotator:
if param.type == 'variable': if param.type == 'variable':
has_variable = True has_variable = True
break break
#if not has_variable: if not has_variable:
# # if one parameter is a variable, let variable choice if it's mandatory # if one parameter is a variable, let variable choice if it's mandatory
# variable.mandatory = True variable.mandatory = True
if has_value: if has_value:
# if has value but without any calculation # if has value but without any calculation
variable.mandatory = True variable.mandatory = True

View File

@ -3,17 +3,20 @@
fichier de configuration pour rougail fichier de configuration pour rougail
""" """
from os.path import join, isfile, abspath, dirname from os.path import join, abspath, dirname
from pathlib import Path
rougailroot = '/var/rougail' rougailroot = '/var/rougail'
patch_dir = join(rougailroot, 'patches')
manifests_dir = join(rougailroot, 'manifests')
templates_dir = join(rougailroot, 'templates')
dtddir = join(dirname(abspath(__file__)), 'data') dtddir = join(dirname(abspath(__file__)), 'data')
dtdfilename = join(dtddir, 'rougail.dtd')
Config = {'rougailroot': rougailroot,
'patch_dir': join(rougailroot, 'patches'),
'manifests_dir': join(rougailroot, 'manifests'),
'templates_dir': join(rougailroot, 'templates'),
'dtdfilename': join(dtddir, 'rougail.dtd'),
'dtddir': dtddir,
# chemin du répertoire source des fichiers templates # chemin du répertoire source des fichiers templates
patch_dir = '/srv/rougail/patch' 'patch_dir': '/srv/rougail/patch',
'variable_namespace': 'rougail',
variable_namespace = 'rougail' }

View File

@ -141,7 +141,7 @@
<!ATTLIST group description CDATA #IMPLIED> <!ATTLIST group description CDATA #IMPLIED>
<!ELEMENT param (#PCDATA)> <!ELEMENT param (#PCDATA)>
<!ATTLIST param type (string|number|variable|information|suffix) "string"> <!ATTLIST param type (string|variable|number|python) "string">
<!ATTLIST param name CDATA #IMPLIED> <!ATTLIST param name CDATA #IMPLIED>
<!ATTLIST param notraisepropertyerror (True|False) "False"> <!ATTLIST param notraisepropertyerror (True|False) "False">
<!ATTLIST param optional (True|False) "False"> <!ATTLIST param optional (True|False) "False">

View File

@ -32,7 +32,7 @@ from .tiramisureflector import TiramisuReflector
from .utils import normalize_family from .utils import normalize_family
from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyError from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyError
from .path import Path from .path import Path
from .config import variable_namespace from .config import Config
# CreoleObjSpace's elements like 'family' or 'follower', that shall be forced to the Redefinable type # CreoleObjSpace's elements like 'family' or 'follower', that shall be forced to the Redefinable type
FORCE_REDEFINABLES = ('family', 'follower', 'service', 'disknod', 'variables') FORCE_REDEFINABLES = ('family', 'follower', 'service', 'disknod', 'variables')
@ -329,7 +329,7 @@ class CreoleObjSpace:
def is_already_exists(self, name, space, child, namespace): def is_already_exists(self, name, space, child, namespace):
if isinstance(space, self.family): # pylint: disable=E1101 if isinstance(space, self.family): # pylint: disable=E1101
if namespace != variable_namespace: if namespace != Config['variable_namespace']:
name = space.path + '.' + name name = space.path + '.' + name
return self.paths.path_is_defined(name) return self.paths.path_is_defined(name)
if child.tag == 'family': if child.tag == 'family':
@ -362,14 +362,14 @@ class CreoleObjSpace:
else: else:
norm_name = name norm_name = name
return getattr(family, variable.tag)[norm_name] return getattr(family, variable.tag)[norm_name]
if namespace == variable_namespace: if namespace == Config['variable_namespace']:
path = name path = name
else: else:
path = family.path + '.' + name path = family.path + '.' + name
old_family_name = self.paths.get_variable_family_name(path) old_family_name = self.paths.get_variable_family_name(path)
if normalize_family(family.name) == old_family_name: if normalize_family(family.name) == old_family_name:
return getattr(family, variable.tag)[name] return getattr(family, variable.tag)[name]
old_family = self.space.variables[variable_namespace].family[old_family_name] # pylint: disable=E1101 old_family = self.space.variables[Config['variable_namespace']].family[old_family_name] # pylint: disable=E1101
variable_obj = old_family.variable[name] variable_obj = old_family.variable[name]
del old_family.variable[name] del old_family.variable[name]
if 'variable' not in vars(family): if 'variable' not in vars(family):
@ -501,7 +501,7 @@ class CreoleObjSpace:
document.attrib.get('dynamic') != None, document.attrib.get('dynamic') != None,
variableobj) variableobj)
if child.attrib.get('redefine', 'False') == 'True': if child.attrib.get('redefine', 'False') == 'True':
if namespace == variable_namespace: if namespace == Config['variable_namespace']:
self.redefine_variables.append(child.attrib['name']) self.redefine_variables.append(child.attrib['name'])
else: else:
self.redefine_variables.append(namespace + '.' + family_name + '.' + self.redefine_variables.append(namespace + '.' + family_name + '.' +
@ -509,7 +509,7 @@ class CreoleObjSpace:
elif child.tag == 'family': elif child.tag == 'family':
family_name = normalize_family(child.attrib['name']) family_name = normalize_family(child.attrib['name'])
if namespace != variable_namespace: if namespace != Config['variable_namespace']:
family_name = namespace + '.' + family_name family_name = namespace + '.' + family_name
self.paths.add_family(namespace, self.paths.add_family(namespace,
family_name, family_name,

View File

@ -1,7 +1,7 @@
from .i18n import _ from .i18n import _
from .utils import normalize_family from .utils import normalize_family
from .error import OperationError, DictConsistencyError from .error import OperationError, DictConsistencyError
from .config import variable_namespace from .config import Config
class Path: class Path:
@ -21,7 +21,7 @@ class Path:
name: str, name: str,
variableobj: str, variableobj: str,
) -> str: # pylint: disable=C0111 ) -> str: # pylint: disable=C0111
if '.' not in name and namespace == variable_namespace: if '.' not in name and namespace == Config['variable_namespace']:
full_name = '.'.join([namespace, name]) full_name = '.'.join([namespace, name])
self.full_paths[name] = full_name self.full_paths[name] = full_name
else: else:
@ -41,12 +41,12 @@ class Path:
check_name=False, check_name=False,
allow_dot=True, allow_dot=True,
) )
if '.' not in name and current_namespace == variable_namespace and name in self.full_paths: if '.' not in name and current_namespace == Config['variable_namespace'] and name in self.full_paths:
name = self.full_paths[name] name = self.full_paths[name]
if current_namespace is None: # pragma: no cover if current_namespace is None: # pragma: no cover
raise OperationError('current_namespace must not be None') raise OperationError('current_namespace must not be None')
dico = self.families[name] dico = self.families[name]
if dico['namespace'] != variable_namespace and current_namespace != dico['namespace']: if dico['namespace'] != Config['variable_namespace'] and current_namespace != dico['namespace']:
raise DictConsistencyError(_('A family located in the {} namespace ' raise DictConsistencyError(_('A family located in the {} namespace '
'shall not be used in the {} namespace').format( 'shall not be used in the {} namespace').format(
dico['namespace'], current_namespace)) dico['namespace'], current_namespace))
@ -87,7 +87,7 @@ class Path:
False, False,
dico['variableobj'], dico['variableobj'],
) )
if namespace == variable_namespace: if namespace == Config['variable_namespace']:
self.full_paths[name] = new_path self.full_paths[name] = new_path
else: else:
name = new_path name = new_path
@ -113,7 +113,7 @@ class Path:
self.full_paths[name] = full_name self.full_paths[name] = full_name
else: else:
full_name = name full_name = name
if namespace == variable_namespace: if namespace == Config['variable_namespace']:
name = name.rsplit('.', 1)[1] name = name.rsplit('.', 1)[1]
self.variables[full_name] = dict(name=name, self.variables[full_name] = dict(name=name,
family=family, family=family,
@ -157,7 +157,7 @@ class Path:
else: else:
dico = self._get_variable(name) dico = self._get_variable(name)
if not allow_source: if not allow_source:
if dico['namespace'] not in [variable_namespace, 'services'] and current_namespace != dico['namespace']: if dico['namespace'] not in [Config['variable_namespace'], 'services'] and current_namespace != dico['namespace']:
raise DictConsistencyError(_('A variable located in the {} namespace ' raise DictConsistencyError(_('A variable located in the {} namespace '
'shall not be used in the {} namespace').format( 'shall not be used in the {} namespace').format(
dico['namespace'], current_namespace)) dico['namespace'], current_namespace))
@ -191,16 +191,12 @@ class Path:
if name not in self.variables: if name not in self.variables:
for var_name, variable in self.variables.items(): for var_name, variable in self.variables.items():
if variable['is_dynamic'] and name.startswith(var_name): if variable['is_dynamic'] and name.startswith(var_name):
if not with_suffix:
raise Exception('This option is dynamic, should use "with_suffix" attribute')
return variable, name[len(var_name):] return variable, name[len(var_name):]
if '.' not in name: if '.' not in name:
for var_name, path in self.full_paths.items(): for var_name, path in self.full_paths.items():
if name.startswith(var_name): if name.startswith(var_name):
variable = self.variables[self.full_paths[var_name]] variable = self.variables[self.full_paths[var_name]]
if variable['is_dynamic']: if variable['is_dynamic']:
if not with_suffix:
raise Exception('This option is dynamic, should use "with_suffix" attribute')
return variable, name[len(var_name):] return variable, name[len(var_name):]
raise DictConsistencyError(_('unknown option {}').format(name)) raise DictConsistencyError(_('unknown option {}').format(name))
if with_suffix: if with_suffix:

View File

@ -15,10 +15,14 @@ from os.path import dirname, join, isfile
from Cheetah.Template import Template as ChtTemplate from Cheetah.Template import Template as ChtTemplate
from Cheetah.NameMapper import NotFound as CheetahNotFound from Cheetah.NameMapper import NotFound as CheetahNotFound
try:
from tiramisu3 import Config
from tiramisu3.error import PropertiesOptionError
except:
from tiramisu import Config from tiramisu import Config
from tiramisu.error import PropertiesOptionError from tiramisu.error import PropertiesOptionError
from .config import patch_dir, variable_namespace from .config import Config
from .error import FileNotFound, TemplateError from .error import FileNotFound, TemplateError
from .i18n import _ from .i18n import _
from .utils import normalize_family from .utils import normalize_family
@ -290,7 +294,7 @@ class CreoleTemplateEngine:
patch_no_debug = ['-s', '-r', '-', '--backup-if-mismatch'] patch_no_debug = ['-s', '-r', '-', '--backup-if-mismatch']
# patches variante + locaux # patches variante + locaux
for directory in [join(patch_dir, 'variante'), patch_dir]: for directory in [join(Config['patch_dir'], 'variante'), Config['patch_dir']]:
patch_file = join(directory, f'{filename}.patch') patch_file = join(directory, f'{filename}.patch')
if isfile(patch_file): if isfile(patch_file):
log.info(_("Patching template '{filename}' with '{patch_file}'")) log.info(_("Patching template '{filename}' with '{patch_file}'"))
@ -372,7 +376,7 @@ class CreoleTemplateEngine:
""" """
for option in await self.config.option.list(type='all'): for option in await self.config.option.list(type='all'):
namespace = await option.option.name() namespace = await option.option.name()
if namespace == variable_namespace: if namespace == Config['variable_namespace']:
await self.load_eole_variables_rougail(option) await self.load_eole_variables_rougail(option)
else: else:
families = await self.load_eole_variables(namespace, families = await self.load_eole_variables(namespace,

View File

@ -1,3 +1,6 @@
try:
from tiramisu3 import DynOptionDescription
except:
from tiramisu import DynOptionDescription from tiramisu import DynOptionDescription
from .utils import normalize_family from .utils import normalize_family

View File

@ -1,10 +1,7 @@
"""loader """loader
flattened XML specific flattened XML specific
""" """
from os.path import isfile from .config import Config
from lxml.etree import DTD
from .config import dtdfilename, variable_namespace
from .i18n import _ from .i18n import _
from .error import LoaderError from .error import LoaderError
from .annotator import ERASED_ATTRIBUTES from .annotator import ERASED_ATTRIBUTES
@ -47,7 +44,10 @@ class TiramisuReflector:
funcs_path, funcs_path,
): ):
self.storage = ElementStorage() self.storage = ElementStorage()
self.storage.text = ["from tiramisu import *", self.storage.text = ["try:",
" from tiramisu3 import *",
"except:",
" from tiramisu import *",
"from rougail.tiramisu import ConvertDynOptionDescription", "from rougail.tiramisu import ConvertDynOptionDescription",
"import imp", "import imp",
f"func = imp.load_source('func', '{funcs_path}')", f"func = imp.load_source('func', '{funcs_path}')",
@ -80,10 +80,10 @@ class TiramisuReflector:
# variable_namespace family has to be loaded before any other family # variable_namespace family has to be loaded before any other family
# because `extra` family could use `variable_namespace` variables. # because `extra` family could use `variable_namespace` variables.
if hasattr(xmlroot, 'variables'): if hasattr(xmlroot, 'variables'):
if variable_namespace in xmlroot.variables: if Config['variable_namespace'] in xmlroot.variables:
yield xmlroot.variables[variable_namespace] yield xmlroot.variables[Config['variable_namespace']]
for xmlelt, value in xmlroot.variables.items(): for xmlelt, value in xmlroot.variables.items():
if xmlelt != variable_namespace: if xmlelt != Config['variable_namespace']:
yield value yield value
if hasattr(xmlroot, 'services'): if hasattr(xmlroot, 'services'):
yield xmlroot.services yield xmlroot.services
@ -252,7 +252,7 @@ class Common:
if not self.attrib[key]: if not self.attrib[key]:
continue continue
value = "frozenset({" + self.attrib[key] + "})" value = "frozenset({" + self.attrib[key] + "})"
elif key in ['default', 'multi', 'suffixes', 'validators', 'values']: elif key in ['default', 'multi', 'suffixes', 'validators']:
value = self.attrib[key] value = self.attrib[key]
elif isinstance(value, str) and key != 'opt' and not value.startswith('['): elif isinstance(value, str) and key != 'opt' and not value.startswith('['):
value = "'" + value.replace("'", "\\\'") + "'" value = "'" + value.replace("'", "\\\'") + "'"
@ -368,16 +368,9 @@ class Variable(Common):
elif tag == 'check': elif tag == 'check':
self.attrib['validators'].append(self.calculation_value(child, ['ParamSelfOption()'])) self.attrib['validators'].append(self.calculation_value(child, ['ParamSelfOption()']))
elif tag == 'choice': elif tag == 'choice':
if child.type == 'calculation':
value = self.storage.get(child.name).get()
choices = f"Calculation(func.calc_value, Params((ParamOption({value}))))"
else:
choices.append(child.name) choices.append(child.name)
if choices: if choices:
if isinstance(choices, list): self.attrib['values'] = tuple(choices)
self.attrib['values'] = str(tuple(choices))
else:
self.attrib['values'] = choices
if self.attrib['default'] == []: if self.attrib['default'] == []:
del self.attrib['default'] del self.attrib['default']
elif not self.attrib['multi'] and isinstance(self.attrib['default'], list): elif not self.attrib['multi'] and isinstance(self.attrib['default'], list):
@ -422,10 +415,6 @@ class Variable(Common):
if hasattr(param, 'suffix'): if hasattr(param, 'suffix'):
value['suffix'] = param.suffix value['suffix'] = param.suffix
return self.build_param(value) return self.build_param(value)
elif param.type == 'information':
return f'ParamInformation("{param.text}", None)'
elif param.type == 'suffix':
return f'ParamSuffix()'
raise LoaderError(_('unknown param type {}').format(param.type)) raise LoaderError(_('unknown param type {}').format(param.type))
def populate_value(self, def populate_value(self,

View File

@ -0,0 +1,11 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_2 = OptionDescription(name='tata', doc='tata', children=[])
option_2.impl_set_information("manage", True)
option_1 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View File

@ -0,0 +1,12 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_3 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'basic'}), children=[option_3, option_4])
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,12 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_3 = ChoiceOption(properties=frozenset({'auto_freeze', 'expert', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4])
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,11 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset({'basic', 'force_store_value', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'basic'}), children=[option_3])
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,11 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset({'expert', 'force_store_value', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'expert'}), children=[option_3])
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,11 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3])
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,12 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_4 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='without_type', doc='without_type', multi=False, default='non')
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4])
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,11 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3])
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,12 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4])
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,12 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={})), values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4])
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 @@
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"}

View File

@ -0,0 +1,12 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((), kwargs={})), values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4])
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,11 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Redefine description', multi=True, default=['non'], default_multi='non', values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
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 @@
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non", "rougail.general.module_instancie": "non"}

View File

@ -0,0 +1,13 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_3 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={})), values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3, option_4, option_5])
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 @@
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"}

View File

@ -0,0 +1,12 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_3 = ChoiceOption(properties=frozenset({'basic', 'force_store_value', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={})), values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3, option_4])
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 @@
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"}

View File

@ -0,0 +1,12 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={})), values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4])
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 @@
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"}

View File

@ -0,0 +1,12 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={})), values=('oui', 'non'))
option_2 = OptionDescription(name='general', doc='Général', properties=frozenset({'normal'}), children=[option_3, option_4])
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,26 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<services/>
<variables>
<family name="general" mode="basic">
<variable name="mode_conteneur_actif" type="domain" description="No change" mandatory="True" mode="expert"/>
<variable name="mode_conteneur_actif1" type="oui/non" description="No change">
<value>non</value>
</variable>
</family>
<separators/>
</variables>
<constraints>
<fill name="calc_val" target="mode_conteneur_actif">
<param type="variable">mode_conteneur_actif1</param>
</fill>
</constraints>
<help/>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View File

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

View File

@ -0,0 +1,12 @@
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
import imp
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non'))
option_3 = DomainnameOption(type='domainname', allow_ip=False, properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=False, todict=False)), kwargs={})))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

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