Compare commits
4 commits
1858eeeb06
...
ae89e30e60
| Author | SHA1 | Date | |
|---|---|---|---|
| ae89e30e60 | |||
| e1b2d36aae | |||
| cc086f086a | |||
| 7ee65b6cab |
10 changed files with 46 additions and 5 deletions
13
CHANGELOG.md
13
CHANGELOG.md
|
|
@ -1,3 +1,16 @@
|
||||||
|
## 1.2.0a15 (2025-04-01)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- can link regexp variable
|
||||||
|
- can link choice variable
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- update tests
|
||||||
|
- do not raise variable in property with force_optional
|
||||||
|
- update translation
|
||||||
|
|
||||||
## 1.2.0a14 (2025-03-30)
|
## 1.2.0a14 (2025-03-30)
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rougail"
|
name = "rougail"
|
||||||
version = "1.2.0a14"
|
version = "1.2.0a15"
|
||||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
description = "A consistency handling system that was initially designed in the configuration management"
|
description = "A consistency handling system that was initially designed in the configuration management"
|
||||||
|
|
|
||||||
|
|
@ -589,7 +589,9 @@ class VariablePropertyCalculation(_VariableCalculation):
|
||||||
identifier,
|
identifier,
|
||||||
needs_multi=False,
|
needs_multi=False,
|
||||||
)
|
)
|
||||||
if params[None] and "variable" in params[None][0]:
|
if objectspace.force_optional and (not params[None] or "variable" not in params[None][0]):
|
||||||
|
params = {None: [None, None, False]}
|
||||||
|
else:
|
||||||
variable = params[None][0]["variable"]
|
variable = params[None][0]["variable"]
|
||||||
if self.when is not undefined:
|
if self.when is not undefined:
|
||||||
if self.version == "1.0":
|
if self.version == "1.0":
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ from rougail.error import display_xmlfiles
|
||||||
from tiramisu import DynOptionDescription, calc_value, function_waiting_for_error
|
from tiramisu import DynOptionDescription, calc_value, function_waiting_for_error
|
||||||
from tiramisu.error import ValueWarning, ConfigError, PropertiesOptionError, CancelParam
|
from tiramisu.error import ValueWarning, ConfigError, PropertiesOptionError, CancelParam
|
||||||
from .utils import normalize_family
|
from .utils import normalize_family
|
||||||
|
from .i18n import _
|
||||||
|
|
||||||
|
|
||||||
global func
|
global func
|
||||||
|
|
@ -163,7 +164,7 @@ def jinja_to_function(
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
kw_str = ", ".join(kw_to_string(kw))
|
kw_str = ", ".join(kw_to_string(kw))
|
||||||
raise ConfigError(
|
raise ConfigError(
|
||||||
f'cannot calculating "{__internal_attribute}" attribute for variable "{__internal_variable}" in {display_xmlfiles(__internal_files)} with parameters "{kw_str}": {err}'
|
_('cannot calculating "{0}" attribute for variable "{1}" in {2} with parameters "{3}": {4}').format(__internal_attribute, __internal_variable, display_xmlfiles(__internal_files), kw_str, err)
|
||||||
) from err
|
) from err
|
||||||
convert = CONVERT_OPTION[__internal_type].get("func", str)
|
convert = CONVERT_OPTION[__internal_type].get("func", str)
|
||||||
if __internal_multi:
|
if __internal_multi:
|
||||||
|
|
|
||||||
10
tests/dictionaries/00_6regexp_link/makedict/after.json
Normal file
10
tests/dictionaries/00_6regexp_link/makedict/after.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "#a1a1a1"
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "#a1a1a1"
|
||||||
|
}
|
||||||
|
}
|
||||||
4
tests/dictionaries/00_6regexp_link/makedict/base.json
Normal file
4
tests/dictionaries/00_6regexp_link/makedict/base.json
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": "#a1a1a1",
|
||||||
|
"rougail.var2": "#a1a1a1"
|
||||||
|
}
|
||||||
10
tests/dictionaries/00_6regexp_link/makedict/before.json
Normal file
10
tests/dictionaries/00_6regexp_link/makedict/before.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "#a1a1a1"
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "#a1a1a1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
[]
|
||||||
|
|
@ -21,6 +21,6 @@ class Regexp_option_3(RegexpOption):
|
||||||
Regexp_option_3._regexp = re_compile(r"^#(?:[0-9a-f]{3}){1,2}$")
|
Regexp_option_3._regexp = re_compile(r"^#(?:[0-9a-f]{3}){1,2}$")
|
||||||
|
|
||||||
option_2 = Regexp_option_2(name="var1", doc="a first variable", default="#a1a1a1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'regexp', 'test': ('#b1b1b1', '#b2b2b2')})
|
option_2 = Regexp_option_2(name="var1", doc="a first variable", default="#a1a1a1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'regexp', 'test': ('#b1b1b1', '#b2b2b2')})
|
||||||
option_3 = Regexp_option_3(name="var2", doc="a second variable", default=Calculation(func['calc_value'], Params((ParamOption(option_2)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'regexp'})
|
option_3 = Regexp_option_3(name="var2", doc="a second variable", default=Calculation(func['calc_value'], Params((ParamOption(option_2)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'regexp', 'test': ('#b2b1b1', '#b3b2b2')})
|
||||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3], properties=frozenset({"standard"}))
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3], properties=frozenset({"standard"}))
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ class Regexp_option_2(RegexpOption):
|
||||||
Regexp_option_2._regexp = re_compile(r"^#(?:[0-9a-f]{3}){1,2}$")
|
Regexp_option_2._regexp = re_compile(r"^#(?:[0-9a-f]{3}){1,2}$")
|
||||||
|
|
||||||
option_1 = Regexp_option_1(name="var1", doc="a first variable", default="#a1a1a1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'regexp', 'test': ('#b1b1b1', '#b2b2b2')})
|
option_1 = Regexp_option_1(name="var1", doc="a first variable", default="#a1a1a1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'regexp', 'test': ('#b1b1b1', '#b2b2b2')})
|
||||||
option_2 = Regexp_option_2(name="var2", doc="a second variable", default=Calculation(func['calc_value'], Params((ParamOption(option_1)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'regexp'})
|
option_2 = Regexp_option_2(name="var2", doc="a second variable", default=Calculation(func['calc_value'], Params((ParamOption(option_1)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'regexp', 'test': ('#b2b1b1', '#b3b2b2')})
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue