mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
form: remove no longer used hydrate_option_type method
This commit is contained in:
parent
3a5d353c4b
commit
3cae07970e
1 changed files with 4 additions and 17 deletions
|
@ -1310,7 +1310,10 @@ class OptionsModel(BaseModel):
|
||||||
for id_, data in options.items():
|
for id_, data in options.items():
|
||||||
option = data | {
|
option = data | {
|
||||||
"id": data.get("id", id_),
|
"id": data.get("id", id_),
|
||||||
"type": data.get("type", OptionType.select if "choices" in data else OptionType.string),
|
"type": data.get(
|
||||||
|
"type",
|
||||||
|
OptionType.select if "choices" in data else OptionType.string,
|
||||||
|
),
|
||||||
"optional": data.get("optional", optional),
|
"optional": data.get("optional", optional),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1414,22 +1417,6 @@ def build_form(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def hydrate_option_type(raw_option: dict[str, Any]) -> dict[str, Any]:
|
|
||||||
type_ = raw_option.get(
|
|
||||||
"type", OptionType.select if "choices" in raw_option else OptionType.string
|
|
||||||
)
|
|
||||||
# LEGACY (`choices` in option `string` used to be valid)
|
|
||||||
if "choices" in raw_option and type_ == OptionType.string:
|
|
||||||
logger.warning(
|
|
||||||
f"Packagers: option {raw_option['id']} has 'choices' but has type 'string', use 'select' instead to remove this warning."
|
|
||||||
)
|
|
||||||
type_ = OptionType.select
|
|
||||||
|
|
||||||
raw_option["type"] = type_
|
|
||||||
|
|
||||||
return raw_option
|
|
||||||
|
|
||||||
|
|
||||||
# ╭───────────────────────────────────────────────────────╮
|
# ╭───────────────────────────────────────────────────────╮
|
||||||
# │ ╷ ╷╶┬╴╶┬╴╷ ╭─╴ │
|
# │ ╷ ╷╶┬╴╶┬╴╷ ╭─╴ │
|
||||||
# │ │ │ │ │ │ ╰─╮ │
|
# │ │ │ │ │ │ ╰─╮ │
|
||||||
|
|
Loading…
Add table
Reference in a new issue