From f2461a2fea9f9d8a8fca6ef411fb8531a8c0c364 Mon Sep 17 00:00:00 2001 From: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com> Date: Sat, 30 Aug 2025 22:33:43 +0200 Subject: [PATCH] WebHost: Ensure that OptionSets and OptionLists get exported to yaml, even when nothing is selected (#5240) * Ensure that OptionSets and OptionLists get exported to yaml, even if nothing is selected * forgot ItemSet and LocationSet * Make it even less likely for there to be overlap --- WebHostLib/options.py | 9 +++++++-- WebHostLib/templates/playerOptions/macros.html | 4 ++++ WebHostLib/templates/weightedOptions/macros.html | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/WebHostLib/options.py b/WebHostLib/options.py index 38489cee..3c63fa8c 100644 --- a/WebHostLib/options.py +++ b/WebHostLib/options.py @@ -155,7 +155,9 @@ def generate_weighted_yaml(game: str): options = {} for key, val in request.form.items(): - if "||" not in key: + if val == "_ensure-empty-list": + options[key] = {} + elif "||" not in key: if len(str(val)) == 0: continue @@ -212,8 +214,11 @@ def generate_yaml(game: str): if request.method == "POST": options = {} intent_generate = False + for key, val in request.form.items(multi=True): - if key in options: + if val == "_ensure-empty-list": + options[key] = [] + elif options.get(key): if not isinstance(options[key], list): options[key] = [options[key]] options[key].append(val) diff --git a/WebHostLib/templates/playerOptions/macros.html b/WebHostLib/templates/playerOptions/macros.html index bbb3c75d..a4cc3aa5 100644 --- a/WebHostLib/templates/playerOptions/macros.html +++ b/WebHostLib/templates/playerOptions/macros.html @@ -134,6 +134,7 @@ {% macro OptionList(option_name, option) %} {{ OptionTitle(option_name, option) }} +