diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-02-19 02:12:17 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-02-19 02:42:56 +0800 |
commit | b7a1118ba097197b8dad50794f24dafd0235db86 (patch) | |
tree | e03fe9469b19908b2072dd5ca3ce7f2b745da882 /tools/cru-py/cru/service/_config.py | |
parent | 4c5df72057fe02257e243de37930a47425a84722 (diff) | |
download | crupest-b7a1118ba097197b8dad50794f24dafd0235db86.tar.gz crupest-b7a1118ba097197b8dad50794f24dafd0235db86.tar.bz2 crupest-b7a1118ba097197b8dad50794f24dafd0235db86.zip |
fix(cru-py): config item.
Diffstat (limited to 'tools/cru-py/cru/service/_config.py')
-rw-r--r-- | tools/cru-py/cru/service/_config.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/cru-py/cru/service/_config.py b/tools/cru-py/cru/service/_config.py index 6aa6294..cbb9533 100644 --- a/tools/cru-py/cru/service/_config.py +++ b/tools/cru-py/cru/service/_config.py @@ -1,7 +1,7 @@ from collections.abc import Iterable from typing import Any, Literal, overload -from cru import CruException +from cru import CruException, CruNotFound from cru.config import Configuration, ConfigItem from cru.value import ( INTEGER_VALUE_TYPE, @@ -360,14 +360,15 @@ class ConfigManager(AppCommandFeatureProvider): error_entries: list[SimpleLineConfigParser.Entry] = [] errors: list[CruValueTypeError] = [] for key, entry in entry_dict.items(): - config_item = self.configuration.get(key) try: if entry.value == "": value_dict[key] = None else: - value_dict[key] = config_item.value_type.convert_str_to_value( - entry.value - ) + value = entry.value + config_item = self.configuration.get_or(key) + if config_item is not CruNotFound.VALUE: + value = config_item.value_type.convert_str_to_value(value) + value_dict[key] = value except CruValueTypeError as e: error_entries.append(entry) errors.append(e) |