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