From 0100c692b20f890a60cfc6464a71f7fc345e1411 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 7 Feb 2021 09:23:01 +0100 Subject: [PATCH] notraisepropertyerror => propertyerror --- src/rougail/data/rougail.dtd | 13 +++++----- src/rougail/tiramisureflector.py | 4 ++-- .../10load_disabled_if_in_fill/00-base.xml | 24 +++++++++++++++++++ .../10load_disabled_if_in_fill/__init__.py | 0 .../makedict/base.json | 1 + .../tiramisu/base.py | 20 ++++++++++++++++ .../60extra_help/extra_dirs/extra/00-base.xml | 2 +- .../60extra_load/extra_dirs/extra/00-base.xml | 2 +- .../extra_dirs/extra/00-base.xml | 2 +- .../extra_dirs/extra/00-base.xml | 2 +- .../extra_dirs/extra/00-base.xml | 2 +- .../80empty_typeeole_eole/00_base.xml | 4 ++-- .../80empty_typeeole_number/00_base.xml | 4 ++-- .../extra_dirs/rougail/00-base.xml | 2 +- .../extra_dirs/services/00-base.xml | 2 +- 15 files changed, 65 insertions(+), 19 deletions(-) create mode 100644 tests/dictionaries/10load_disabled_if_in_fill/00-base.xml create mode 100644 tests/dictionaries/10load_disabled_if_in_fill/__init__.py create mode 100644 tests/dictionaries/10load_disabled_if_in_fill/makedict/base.json create mode 100644 tests/dictionaries/10load_disabled_if_in_fill/tiramisu/base.py diff --git a/src/rougail/data/rougail.dtd b/src/rougail/data/rougail.dtd index c5c37bd6..bc694394 100644 --- a/src/rougail/data/rougail.dtd +++ b/src/rougail/data/rougail.dtd @@ -111,6 +111,7 @@ + @@ -127,19 +128,19 @@ - - - - - - + + + + + + diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index de07bf9c..5ba1d784 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -334,8 +334,8 @@ class Variable(Common): params.extend([f"'{param.suffix}'", f'{param.family.reflector_name}']) else: param_type = 'ParamOption' - if param.notraisepropertyerror: - params.append(f'notraisepropertyerror={param.notraisepropertyerror}') + if not param.propertyerror: + params.append('notraisepropertyerror=True') return "{}({})".format(param_type, ', '.join(params)) diff --git a/tests/dictionaries/10load_disabled_if_in_fill/00-base.xml b/tests/dictionaries/10load_disabled_if_in_fill/00-base.xml new file mode 100644 index 00000000..d3b28f5b --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_fill/00-base.xml @@ -0,0 +1,24 @@ + + + + + + no + + + + + + + + + no + variable1 + + + variable1 + + + + diff --git a/tests/dictionaries/10load_disabled_if_in_fill/__init__.py b/tests/dictionaries/10load_disabled_if_in_fill/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10load_disabled_if_in_fill/makedict/base.json b/tests/dictionaries/10load_disabled_if_in_fill/makedict/base.json new file mode 100644 index 00000000..d47f4067 --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_fill/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.condition": "no", "rougail.general.variable2": null} diff --git a/tests/dictionaries/10load_disabled_if_in_fill/tiramisu/base.py b/tests/dictionaries/10load_disabled_if_in_fill/tiramisu/base.py new file mode 100644 index 00000000..054cb093 --- /dev/null +++ b/tests/dictionaries/10load_disabled_if_in_fill/tiramisu/base.py @@ -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]) diff --git a/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml index 5e631398..9fc5d561 100644 --- a/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml @@ -15,7 +15,7 @@ non - activer_ejabberd + activer_ejabberd none daily diff --git a/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml index 651c2125..884da0f4 100644 --- a/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml @@ -15,7 +15,7 @@ non - activer_ejabberd + activer_ejabberd none daily diff --git a/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml index 76cfb57b..e6d6ccd1 100644 --- a/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml @@ -14,7 +14,7 @@ non - activer_ejabberd + activer_ejabberd none daily diff --git a/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml index 651c2125..884da0f4 100644 --- a/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml @@ -15,7 +15,7 @@ non - activer_ejabberd + activer_ejabberd none daily diff --git a/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml index 651c2125..884da0f4 100644 --- a/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml @@ -15,7 +15,7 @@ non - activer_ejabberd + activer_ejabberd none daily diff --git a/tests/dictionaries/80empty_typeeole_eole/00_base.xml b/tests/dictionaries/80empty_typeeole_eole/00_base.xml index ce150a02..31ce99fb 100644 --- a/tests/dictionaries/80empty_typeeole_eole/00_base.xml +++ b/tests/dictionaries/80empty_typeeole_eole/00_base.xml @@ -15,9 +15,9 @@ non - + 3128 - toto2 + toto2 diff --git a/tests/dictionaries/80empty_typeeole_number/00_base.xml b/tests/dictionaries/80empty_typeeole_number/00_base.xml index 663843b8..d878380d 100644 --- a/tests/dictionaries/80empty_typeeole_number/00_base.xml +++ b/tests/dictionaries/80empty_typeeole_number/00_base.xml @@ -15,9 +15,9 @@ non - + 3128 - toto2 + toto2 diff --git a/tests/dictionaries/80extra_rougail/extra_dirs/rougail/00-base.xml b/tests/dictionaries/80extra_rougail/extra_dirs/rougail/00-base.xml index 651c2125..f9173523 100644 --- a/tests/dictionaries/80extra_rougail/extra_dirs/rougail/00-base.xml +++ b/tests/dictionaries/80extra_rougail/extra_dirs/rougail/00-base.xml @@ -15,7 +15,7 @@ non - activer_ejabberd + activer_ejabberd none daily diff --git a/tests/dictionaries/80extra_services/extra_dirs/services/00-base.xml b/tests/dictionaries/80extra_services/extra_dirs/services/00-base.xml index 651c2125..884da0f4 100644 --- a/tests/dictionaries/80extra_services/extra_dirs/services/00-base.xml +++ b/tests/dictionaries/80extra_services/extra_dirs/services/00-base.xml @@ -15,7 +15,7 @@ non - activer_ejabberd + activer_ejabberd none daily