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
This commit is contained in:
NewSoupVi
2025-08-30 22:33:43 +02:00
committed by GitHub
parent bb2ecb8a97
commit f2461a2fea
3 changed files with 15 additions and 2 deletions

View File

@@ -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)