From 32764cf13692e4622d4108b57aadc04e4193cf36 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 17 Jan 2023 11:50:23 -0500 Subject: [PATCH] [4] fix square flags --- VERSION | 2 +- modules/meta.py | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index b09de9c6..dbdbd49e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.3-develop3 +1.18.3-develop4 diff --git a/modules/meta.py b/modules/meta.py index d60132c2..75b33ad0 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -328,10 +328,12 @@ class DataFile: var_default = {replace_var(dk, variables): replace_var(dv, variables) for dk, dv in all_init_defaults.items() if dk not in variables} for dkey, dvalue in var_default.items(): final_key = replace_var(dkey, var_default) - final_value = replace_var(dvalue, var_default) if final_key not in optional and final_key not in variables and final_key not in conditionals: - default[final_key] = final_value - default[f"{final_key}_encoded"] = requests.utils.quote(str(final_value)) + default[final_key] = dvalue + if "<<" in str(dvalue): + default[f"{final_key}_encoded"] = re.sub(r'<<(.+)>>', r'<<\1_encoded>>', dvalue) + else: + default[f"{final_key}_encoded"] = requests.utils.quote(str(dvalue)) if "optional" in template: if template["optional"]: @@ -411,8 +413,11 @@ class DataFile: if condition_passed: logger.debug(f'Conditional Variable: {final_key} is "{condition["value"]}"') condition_found = True - variables[final_key] = condition["value"] - variables[f"{final_key}_encoded"] = requests.utils.quote(str(condition["value"])) + if condition["value"] is not None: + variables[final_key] = condition["value"] + variables[f"{final_key}_encoded"] = requests.utils.quote(str(condition["value"])) + else: + optional.append(final_key) break if not condition_found: if "default" in con_value: