add OptionInformation support
This commit is contained in:
parent
b55b8f4d9d
commit
5b3d57812e
@ -422,6 +422,8 @@ class Variable(Common):
|
||||
if hasattr(param, 'suffix'):
|
||||
value['suffix'] = param.suffix
|
||||
return self.build_param(value)
|
||||
elif param.type == 'information':
|
||||
return f'ParamInformation("{param.text}")'
|
||||
raise LoaderError(_('unknown param type {}').format(param.type))
|
||||
|
||||
def populate_value(self,
|
||||
|
@ -1,7 +1,8 @@
|
||||
from tiramisu import valid_not_equal, valid_ip_netmask, calc_value
|
||||
|
||||
def calc_val(*args, **kwargs):
|
||||
pass
|
||||
if len(args) > 0:
|
||||
return args[0]
|
||||
|
||||
|
||||
def concat(*args, **kwargs):
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non", "rougail.general.module_instancie": "non"}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.module_instancie": "non"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"}
|
||||
|
23
tests/flattener_dicos/01fill_information/00-base.xml
Normal file
23
tests/flattener_dicos/01fill_information/00-base.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
|
||||
<services/>
|
||||
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True"/>
|
||||
</family>
|
||||
<separators/>
|
||||
</variables>
|
||||
|
||||
<constraints>
|
||||
<fill name="calc_val" target="mode_conteneur_actif">
|
||||
<param type="information">info</param>
|
||||
</fill>
|
||||
</constraints>
|
||||
|
||||
<help/>
|
||||
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
@ -0,0 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": "value"}
|
@ -0,0 +1,8 @@
|
||||
from tiramisu import *
|
||||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
import imp
|
||||
func = imp.load_source('func', 'tests/flattener_dicos/../eosfunc/test.py')
|
||||
option_3 = StrOption(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((ParamInformation("info")), kwargs={})))
|
||||
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])
|
@ -5,7 +5,7 @@
|
||||
|
||||
<variables>
|
||||
<family name="general" mode="basic">
|
||||
<variable name="mode_conteneur_actif" type="domain" description="No change" mandatory="True" mode="expert"/>
|
||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" mandatory="True" mode="expert"/>
|
||||
<variable name="mode_conteneur_actif1" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -3,7 +3,7 @@ from rougail.tiramisu import ConvertDynOptionDescription
|
||||
import imp
|
||||
func = imp.load_source('func', 'tests/flattener_dicos/../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_3 = ChoiceOption(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={})), 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])
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"}
|
||||
{"rougail.general.mode_conteneur_actif": 3, "rougail.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif1": "non"}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.autosavevar": null}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.autosavevar": "oui"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.autosavevar": null}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.autosavevar": "oui"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": null, "rougail.general.mode_conteneur_actif2": "non"}
|
||||
{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": "test", "rougail.enumfam.varmulti": ["test"]}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.varmulti": ["test"], "rougail.enumfam.enumvar": "test"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": "val", "rougail.dynval2.vardynval2": "val", "rougail.new.newvar": null}
|
||||
{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": "val", "rougail.dynval2.vardynval2": "val", "rougail.new.newvar": "val"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.varname": [1, 2], "rougail.dyn1.vardyn1": "val", "rougail.dyn2.vardyn2": "val", "rougail.new.newvar": null}
|
||||
{"rougail.general.varname": [1, 2], "rougail.dyn1.vardyn1": "val", "rougail.dyn2.vardyn2": "val", "rougail.new.newvar": "val"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": null}
|
||||
{"rougail.general.mode_conteneur_actif": "value"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": null}
|
||||
{"rougail.general.mode_conteneur_actif": "value"}
|
||||
|
@ -1 +1 @@
|
||||
{"rougail.general.mode_conteneur_actif": "non", "extra.test.delay": 0, "extra.test.calc_url": null}
|
||||
{"rougail.general.mode_conteneur_actif": "non", "extra.test.delay": 0, "extra.test.calc_url": "http://localhost/"}
|
||||
|
@ -48,6 +48,7 @@ async def launch_flattener(test_dir):
|
||||
config = await Config(mod.option_0)
|
||||
await config.property.read_only()
|
||||
await config.property.pop('mandatory')
|
||||
await config.information.set('info', 'value')
|
||||
config_dict = await config.value.dict()
|
||||
if config_dict:
|
||||
if not isdir(makedict_dir):
|
||||
|
Loading…
Reference in New Issue
Block a user