notraisepropertyerror => propertyerror
This commit is contained in:
parent
f03fcfa11a
commit
0100c692b2
15 changed files with 65 additions and 19 deletions
|
@ -111,6 +111,7 @@
|
||||||
<!ELEMENT value (#PCDATA)>
|
<!ELEMENT value (#PCDATA)>
|
||||||
|
|
||||||
<!ELEMENT constraints ((fill* | check* | condition* | group*)*)>
|
<!ELEMENT constraints ((fill* | check* | condition* | group*)*)>
|
||||||
|
|
||||||
<!ELEMENT fill (param*)>
|
<!ELEMENT fill (param*)>
|
||||||
<!ATTLIST fill name CDATA #REQUIRED>
|
<!ATTLIST fill name CDATA #REQUIRED>
|
||||||
<!ATTLIST fill target CDATA #REQUIRED>
|
<!ATTLIST fill target CDATA #REQUIRED>
|
||||||
|
@ -127,19 +128,19 @@
|
||||||
<!ATTLIST condition force_condition_on_fallback (True|False) "False">
|
<!ATTLIST condition force_condition_on_fallback (True|False) "False">
|
||||||
<!ATTLIST condition force_inverse_condition_on_fallback (True|False) "False">
|
<!ATTLIST condition force_inverse_condition_on_fallback (True|False) "False">
|
||||||
|
|
||||||
<!ELEMENT group (follower+)>
|
|
||||||
<!ATTLIST group leader CDATA #REQUIRED>
|
|
||||||
<!ATTLIST group name 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|number|variable|information|suffix) "string">
|
||||||
<!ATTLIST param name CDATA #IMPLIED>
|
<!ATTLIST param name CDATA #IMPLIED>
|
||||||
<!ATTLIST param notraisepropertyerror (True|False) "False">
|
<!ATTLIST param propertyerror (True|False) "True">
|
||||||
<!ATTLIST param optional (True|False) "False">
|
<!ATTLIST param optional (True|False) "False">
|
||||||
|
|
||||||
<!ELEMENT target (#PCDATA)>
|
<!ELEMENT target (#PCDATA)>
|
||||||
<!ATTLIST target type (family|variable|filelist|iplist|portlist) "variable">
|
<!ATTLIST target type (family|variable|filelist|iplist|portlist) "variable">
|
||||||
<!ATTLIST target optional (True|False) "False">
|
<!ATTLIST target optional (True|False) "False">
|
||||||
|
|
||||||
|
<!ELEMENT group (follower+)>
|
||||||
|
<!ATTLIST group leader CDATA #REQUIRED>
|
||||||
|
<!ATTLIST group name CDATA #IMPLIED>
|
||||||
|
<!ATTLIST group description CDATA #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT follower (#PCDATA)>
|
<!ELEMENT follower (#PCDATA)>
|
||||||
|
|
|
@ -334,8 +334,8 @@ class Variable(Common):
|
||||||
params.extend([f"'{param.suffix}'", f'{param.family.reflector_name}'])
|
params.extend([f"'{param.suffix}'", f'{param.family.reflector_name}'])
|
||||||
else:
|
else:
|
||||||
param_type = 'ParamOption'
|
param_type = 'ParamOption'
|
||||||
if param.notraisepropertyerror:
|
if not param.propertyerror:
|
||||||
params.append(f'notraisepropertyerror={param.notraisepropertyerror}')
|
params.append('notraisepropertyerror=True')
|
||||||
return "{}({})".format(param_type, ', '.join(params))
|
return "{}({})".format(param_type, ', '.join(params))
|
||||||
|
|
||||||
|
|
||||||
|
|
24
tests/dictionaries/10load_disabled_if_in_fill/00-base.xml
Normal file
24
tests/dictionaries/10load_disabled_if_in_fill/00-base.xml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="condition" type="string">
|
||||||
|
<value>no</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="variable1" type="string"/>
|
||||||
|
<variable name="variable2" type="string"/>
|
||||||
|
</family>
|
||||||
|
</variables>
|
||||||
|
|
||||||
|
<constraints>
|
||||||
|
<condition name="disabled_if_in" source="condition">
|
||||||
|
<param>no</param>
|
||||||
|
<target type="variable">variable1</target>
|
||||||
|
</condition>
|
||||||
|
<fill name="calc_val" target="variable2">
|
||||||
|
<param type="variable" propertyerror="False">variable1</param>
|
||||||
|
</fill>
|
||||||
|
</constraints>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
|
@ -0,0 +1 @@
|
||||||
|
{"rougail.general.condition": "no", "rougail.general.variable2": null}
|
|
@ -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 = 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_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_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
|
@ -15,7 +15,7 @@
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<param type='variable' name='condition_1' notraisepropertyerror='True'>activer_ejabberd</param>
|
<param type='variable' name='condition_1' propertyerror='False'>activer_ejabberd</param>
|
||||||
<param name='match'>none</param>
|
<param name='match'>none</param>
|
||||||
<param name='mismatch'>daily</param>
|
<param name='mismatch'>daily</param>
|
||||||
</fill>
|
</fill>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<param type='variable' name='condition_1' notraisepropertyerror='True'>activer_ejabberd</param>
|
<param type='variable' name='condition_1' propertyerror='False'>activer_ejabberd</param>
|
||||||
<param name='match'>none</param>
|
<param name='match'>none</param>
|
||||||
<param name='mismatch'>daily</param>
|
<param name='mismatch'>daily</param>
|
||||||
</fill>
|
</fill>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<param type='variable' name='condition_1' notraisepropertyerror='True'>activer_ejabberd</param>
|
<param type='variable' name='condition_1' propertyerror='False'>activer_ejabberd</param>
|
||||||
<param name='match'>none</param>
|
<param name='match'>none</param>
|
||||||
<param name='mismatch'>daily</param>
|
<param name='mismatch'>daily</param>
|
||||||
</fill>
|
</fill>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<param type='variable' name='condition_1' notraisepropertyerror='True'>activer_ejabberd</param>
|
<param type='variable' name='condition_1' propertyerror='False'>activer_ejabberd</param>
|
||||||
<param name='match'>none</param>
|
<param name='match'>none</param>
|
||||||
<param name='mismatch'>daily</param>
|
<param name='mismatch'>daily</param>
|
||||||
</fill>
|
</fill>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<param type='variable' name='condition_1' notraisepropertyerror='True'>activer_ejabberd</param>
|
<param type='variable' name='condition_1' propertyerror='False'>activer_ejabberd</param>
|
||||||
<param name='match'>none</param>
|
<param name='match'>none</param>
|
||||||
<param name='mismatch'>daily</param>
|
<param name='mismatch'>daily</param>
|
||||||
</fill>
|
</fill>
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name="calc_multi_condition" target="toto1">
|
<fill name="calc_multi_condition" target="toto1">
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<param type="variable" name="condition_1" notraisepropertyerror="False"/>
|
<param type="variable" name="condition_1" propertyerror="True"/>
|
||||||
<param name="match">3128</param>
|
<param name="match">3128</param>
|
||||||
<param name="mismatch" type="variable" notraisepropertyerror="False">toto2</param>
|
<param name="mismatch" type="variable" propertyerror="True">toto2</param>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name="calc_multi_condition" target="toto1">
|
<fill name="calc_multi_condition" target="toto1">
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<param type="number" name="condition_2" notraisepropertyerror="False"/>
|
<param type="number" name="condition_2" propertyerror="True"/>
|
||||||
<param name="match">3128</param>
|
<param name="match">3128</param>
|
||||||
<param name="mismatch" type="variable" notraisepropertyerror="False">toto2</param>
|
<param name="mismatch" type="variable" propertyerror="True">toto2</param>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<param type='variable' name='condition_1' notraisepropertyerror='True'>activer_ejabberd</param>
|
<param type='variable' name='condition_1' propertyerror='True'>activer_ejabberd</param>
|
||||||
<param name='match'>none</param>
|
<param name='match'>none</param>
|
||||||
<param name='mismatch'>daily</param>
|
<param name='mismatch'>daily</param>
|
||||||
</fill>
|
</fill>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<param type='variable' name='condition_1' notraisepropertyerror='True'>activer_ejabberd</param>
|
<param type='variable' name='condition_1' propertyerror='False'>activer_ejabberd</param>
|
||||||
<param name='match'>none</param>
|
<param name='match'>none</param>
|
||||||
<param name='mismatch'>daily</param>
|
<param name='mismatch'>daily</param>
|
||||||
</fill>
|
</fill>
|
||||||
|
|
Loading…
Reference in a new issue