Compare commits
2 commits
fecab8aca6
...
b902e15243
| Author | SHA1 | Date | |
|---|---|---|---|
| b902e15243 | |||
| cbccc8087f |
4 changed files with 32 additions and 13 deletions
|
|
@ -1,3 +1,9 @@
|
|||
## 1.2.0a25 (2025-05-14)
|
||||
|
||||
### Feat
|
||||
|
||||
- can launch UserDatas twice
|
||||
|
||||
## 1.2.0a24 (2025-05-12)
|
||||
|
||||
### Fix
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
|||
|
||||
[project]
|
||||
name = "rougail"
|
||||
version = "1.2.0a24"
|
||||
version = "1.2.0a25"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
readme = "README.md"
|
||||
description = "A consistency handling system that was initially designed in the configuration management"
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "1.2.0a24"
|
||||
__version__ = "1.2.0a25"
|
||||
|
|
|
|||
|
|
@ -41,14 +41,25 @@ class UserDatas:
|
|||
def __init__(self, config) -> None:
|
||||
self.config = config
|
||||
|
||||
def user_datas(self, user_datas: List[dict]):
|
||||
def user_datas(self,
|
||||
user_datas: List[dict],
|
||||
*,
|
||||
return_values_not_error=False,
|
||||
user_datas_type: str="user_datas",
|
||||
):
|
||||
self.values = {}
|
||||
self.errors = []
|
||||
self.warnings = []
|
||||
self.show_secrets = False
|
||||
if user_datas_type == "user_datas":
|
||||
self._populate_values(user_datas)
|
||||
else:
|
||||
self.values = user_datas
|
||||
self._auto_configure_dynamics()
|
||||
self._populate_config()
|
||||
if return_values_not_error:
|
||||
return self.values
|
||||
else:
|
||||
self._populate_error_warnings()
|
||||
return {
|
||||
"errors": self.errors,
|
||||
|
|
@ -215,7 +226,7 @@ class UserDatas:
|
|||
try:
|
||||
option.value.set(value)
|
||||
option.information.set(
|
||||
"loaded_from", _("loaded from {0}").format(options["source"])
|
||||
"loaded_from", _("loaded from {0}").format(self.values[path]["source"])
|
||||
)
|
||||
value_is_set = True
|
||||
# value is correctly set, remove variable to the set
|
||||
|
|
@ -287,15 +298,16 @@ class UserDatas:
|
|||
)
|
||||
if option.isfollower():
|
||||
indexes = range(len(value))
|
||||
values = value
|
||||
else:
|
||||
indexes = [None]
|
||||
for index in indexes:
|
||||
try:
|
||||
if option.isfollower():
|
||||
val = value[index]
|
||||
if val is undefined or isinstance(val, CancelParam):
|
||||
value = values[index]
|
||||
if value is undefined or isinstance(value, CancelParam):
|
||||
continue
|
||||
self.config.option(path, index).value.set(val)
|
||||
self.config.option(path, index).value.set(value)
|
||||
else:
|
||||
option.value.set(value)
|
||||
except PropertiesOptionError as err:
|
||||
|
|
@ -364,6 +376,7 @@ class UserDatas:
|
|||
).format(
|
||||
self._display_value(option, value),
|
||||
option.description(with_quote=True),
|
||||
index,
|
||||
err,
|
||||
options["source"],
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue