Compare commits
No commits in common. "4b21b1507fdc5ffbcc65c02d1d43399c9595d4a1" and "3040a11de93296fea17b442f442d0fdaaf32d3ab" have entirely different histories.
4b21b1507f
...
3040a11de9
|
@ -596,9 +596,7 @@ class ConstraintAnnotator:
|
|||
if not hasattr(objectspace.space, 'constraints'):
|
||||
return
|
||||
self.objectspace = objectspace
|
||||
eosfunc = imp.load_source('eosfunc', eosfunc_file)
|
||||
self.functions = dir(eosfunc)
|
||||
self.functions.extend(INTERNAL_FUNCTIONS)
|
||||
self.eosfunc = imp.load_source('eosfunc', eosfunc_file)
|
||||
self.valid_enums = {}
|
||||
if hasattr(self.objectspace.space.constraints, 'check'):
|
||||
self.check_check()
|
||||
|
@ -620,8 +618,10 @@ class ConstraintAnnotator:
|
|||
|
||||
def check_check(self):
|
||||
remove_indexes = []
|
||||
functions = dir(self.eosfunc)
|
||||
functions.extend(INTERNAL_FUNCTIONS)
|
||||
for check_idx, check in enumerate(self.objectspace.space.constraints.check):
|
||||
if not check.name in self.functions:
|
||||
if not check.name in functions:
|
||||
raise DictConsistencyError(_('cannot find check function {}').format(check.name))
|
||||
if hasattr(check, 'param'):
|
||||
param_option_indexes = []
|
||||
|
@ -1008,6 +1008,7 @@ class ConstraintAnnotator:
|
|||
indexes = list(fills.keys())
|
||||
indexes.sort()
|
||||
targets = []
|
||||
eosfunc = dir(self.eosfunc)
|
||||
for idx in indexes:
|
||||
fill = fills[idx]
|
||||
# test if it's redefined calculation
|
||||
|
@ -1015,7 +1016,7 @@ class ConstraintAnnotator:
|
|||
raise DictConsistencyError(_(f"A fill already exists for the target: {fill.target}"))
|
||||
targets.append(fill.target)
|
||||
#
|
||||
if fill.name not in self.functions:
|
||||
if fill.name not in eosfunc:
|
||||
raise DictConsistencyError(_('cannot find fill function {}').format(fill.name))
|
||||
|
||||
namespace = fill.namespace
|
||||
|
@ -1036,9 +1037,6 @@ class ConstraintAnnotator:
|
|||
raise DictConsistencyError(_(f"All '{param.type}' variables must have a value in order to calculate {fill.target}"))
|
||||
if param.type == 'suffix' and hasattr(param, 'text'):
|
||||
raise DictConsistencyError(_(f"All '{param.type}' variables must not have a value in order to calculate {fill.target}"))
|
||||
if param.type == 'string':
|
||||
if not hasattr(param, 'text'):
|
||||
param.text = None
|
||||
if param.type == 'variable':
|
||||
try:
|
||||
param.text, suffix = self.objectspace.paths.get_variable_path(param.text,
|
||||
|
|
|
@ -44,16 +44,13 @@ class TiramisuReflector:
|
|||
funcs_path,
|
||||
):
|
||||
self.storage = ElementStorage()
|
||||
self.storage.text = ["import imp",
|
||||
f"func = imp.load_source('func', '{funcs_path}')",
|
||||
"for key, value in dict(locals()).items():",
|
||||
" if key != ['imp', 'func']:",
|
||||
" setattr(func, key, value)",
|
||||
"try:",
|
||||
self.storage.text = ["try:",
|
||||
" from tiramisu3 import *",
|
||||
"except:",
|
||||
" from tiramisu import *",
|
||||
"from rougail.tiramisu import ConvertDynOptionDescription",
|
||||
"import imp",
|
||||
f"func = imp.load_source('func', '{funcs_path}')",
|
||||
]
|
||||
self.make_tiramisu_objects(xmlroot)
|
||||
# parse object
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="proxy authentifié">
|
||||
<variable name="toto1" type="port" description="Port d'écoute du proxy" mode="expert">
|
||||
</variable>
|
||||
<variable name="toto2" type="port" description="Port d'écoute du proxy NTLM" mode="expert">
|
||||
<value>3127</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<fill name="calc_multi_condition" target="toto1">
|
||||
<param/>
|
||||
</fill>
|
||||
</constraints>
|
||||
|
||||
</rougail>
|
|
@ -1,2 +0,0 @@
|
|||
{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
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 = PortOption(allow_private=True, properties=frozenset({'expert'}), name='toto1', doc='Port d\'écoute du proxy', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("None")), kwargs={})))
|
||||
option_4 = PortOption(allow_private=True, properties=frozenset({'expert', 'mandatory'}), name='toto2', doc='Port d\'écoute du proxy NTLM', multi=False, default='3127')
|
||||
option_2 = OptionDescription(name='proxy_authentifie', doc='proxy authentifié', properties=frozenset({'expert'}), 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])
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="proxy authentifié">
|
||||
<variable name="toto1" type="port" description="Port d'écoute du proxy" mode="expert">
|
||||
</variable>
|
||||
<variable name="toto2" type="port" description="Port d'écoute du proxy NTLM" mode="expert">
|
||||
<value>3127</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<fill name="calc_multi_condition" target="toto1">
|
||||
<param name="value"/>
|
||||
</fill>
|
||||
</constraints>
|
||||
|
||||
</rougail>
|
|
@ -1,2 +0,0 @@
|
|||
{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
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 = PortOption(allow_private=True, properties=frozenset({'expert'}), name='toto1', doc='Port d\'écoute du proxy', multi=False, default=Calculation(func.calc_multi_condition, Params((), kwargs={'value': ParamValue("None")})))
|
||||
option_4 = PortOption(allow_private=True, properties=frozenset({'expert', 'mandatory'}), name='toto2', doc='Port d\'écoute du proxy NTLM', multi=False, default='3127')
|
||||
option_2 = OptionDescription(name='proxy_authentifie', doc='proxy authentifié', properties=frozenset({'expert'}), 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])
|
|
@ -12,9 +12,7 @@
|
|||
|
||||
<constraints>
|
||||
<check name="valid_enum" target="mode_conteneur_actif">
|
||||
<param>a</param>
|
||||
<param>b</param>
|
||||
<param>c</param>
|
||||
<param>['a','b','c']</param>
|
||||
</check>
|
||||
</constraints>
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="proxy authentifié">
|
||||
<variable name="toto1" type="port" description="Port d'écoute du proxy" mode="expert">
|
||||
</variable>
|
||||
<variable name="toto2" type="port" description="Port d'écoute du proxy NTLM" mode="expert">
|
||||
<value>3127</value>
|
||||
</variable>
|
||||
</family>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<fill name="calc_multi_condition" target="toto1">
|
||||
<param name="value" type="number"/>
|
||||
</fill>
|
||||
</constraints>
|
||||
|
||||
</rougail>
|
|
@ -17,9 +17,7 @@
|
|||
|
||||
<constraints>
|
||||
<check name="valid_enum" target="enumvar">
|
||||
<param>a</param>
|
||||
<param>b</param>
|
||||
<param>c</param>
|
||||
<param>['a', 'b', 'c']</param>
|
||||
</check>
|
||||
</constraints>
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
|
||||
<constraints>
|
||||
<check name="valid_enum" target="enumvar">
|
||||
<param>1</param>
|
||||
<param>2</param>
|
||||
<param>3</param>
|
||||
<param>[1, 2, 3]</param>
|
||||
</check>
|
||||
</constraints>
|
||||
|
||||
|
|
Loading…
Reference in New Issue