Fix get_default_values

For choices, default value is the first of either list or dict.
This commit is contained in:
Salamandar 2024-01-06 17:06:39 +01:00 committed by GitHub
parent 27c4baa97b
commit 472e316a97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,8 +35,8 @@ def get_default_values_for_questions(manifest, raise_if_no_default=True):
elif question["type"] == "password": elif question["type"] == "password":
yield (name, "SomeSuperStrongPassword1234") yield (name, "SomeSuperStrongPassword1234")
elif question.get("choices"): elif question.get("choices"):
if isinstance(question["choices"]): if isinstance(question["choices"], list):
choices = str(question["choices"]) choices = question["choices"]
else: else:
choices = list(question["choices"].keys()) choices = list(question["choices"].keys())
yield (name, choices[0]) yield (name, choices[0])