configpanels/forms : more edge cases with some questions not implementing some methods/attributes

This commit is contained in:
Alexandre Aubin 2023-08-22 17:36:12 +02:00
parent 07daa68770
commit b0fe49ae83

View file

@ -160,11 +160,15 @@ class ConfigPanel:
result[key] = {"ask": ask}
if "current_value" in option:
question_class = OPTIONS[option.get("type", OptionType.string)]
result[key]["value"] = question_class.humanize(
option["current_value"], option
)
if hasattr(question_class, "humanize"):
result[key]["value"] = question_class.humanize(
option["current_value"], option
)
else:
result[key]["value"] = option["current_value"]
# FIXME: semantics, technically here this is not about a prompt...
if question_class.hide_user_input_in_prompt:
if getattr(question_class, "hide_user_input_in_prompt", None):
result[key][
"value"
] = "**************" # Prevent displaying password in `config get`