From 66cfcb53d733d752fb6fee690fcfbd91f6193e5f Mon Sep 17 00:00:00 2001 From: Yossef Mendelssohn Date: Thu, 4 Apr 2024 13:07:53 -0400 Subject: [PATCH 1/2] let conditional .not work on default vars Instead of needing the variable value to be directly declared, it could be one of the default values. --- modules/meta.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/meta.py b/modules/meta.py index 8aff78b1..77900e22 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -399,8 +399,17 @@ class DataFile: error_text = "- exists" con_var_value = var_key[:-7] elif var_key.endswith(".not"): - if var_key[:-4] in variables: - con_var_value = variables[var_key[:-4]] + var_name = var_key[:-4] + if var_name in variables: + con_var_value = variables[var_name] + if isinstance(var_value, list): + if con_var_value in var_value: + error_text = f'in {var_value}' + elif str(con_var_value) == str(var_value): + error_text = f'is "{var_value}"' + elif var_name in default: + # TODO: consolidate + con_var_value = default[var_name] if isinstance(var_value, list): if con_var_value in var_value: error_text = f'in {var_value}' From 33be6976e1903c8437553161685423f463c2ad59 Mon Sep 17 00:00:00 2001 From: Yossef Mendelssohn Date: Thu, 4 Apr 2024 21:46:21 -0400 Subject: [PATCH 2/2] a little consolidation/cleanup --- modules/meta.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/modules/meta.py b/modules/meta.py index 77900e22..66ad1aa1 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -400,16 +400,8 @@ class DataFile: con_var_value = var_key[:-7] elif var_key.endswith(".not"): var_name = var_key[:-4] - if var_name in variables: - con_var_value = variables[var_name] - if isinstance(var_value, list): - if con_var_value in var_value: - error_text = f'in {var_value}' - elif str(con_var_value) == str(var_value): - error_text = f'is "{var_value}"' - elif var_name in default: - # TODO: consolidate - con_var_value = default[var_name] + if var_name in variables or var_name in default: + con_var_value = variables[var_name] if var_name in variables else default[var_name] if isinstance(var_value, list): if con_var_value in var_value: error_text = f'in {var_value}'