From b0fe49ae8390299d022c84b5c824057fc28f7c31 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 22 Aug 2023 17:36:12 +0200 Subject: [PATCH] configpanels/forms : more edge cases with some questions not implementing some methods/attributes --- src/utils/configpanel.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/utils/configpanel.py b/src/utils/configpanel.py index ee9019303..12024855a 100644 --- a/src/utils/configpanel.py +++ b/src/utils/configpanel.py @@ -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`