diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index 790771a42..3286bf0a1 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -83,10 +83,14 @@ class Annotator(TargetAnnotator, ParamAnnotator, Walk): variable.force_store_value = True if variable.auto_save: continue + auto_freeze_variable = self.objectspace.rougailconfig['auto_freeze_variable'] + if not self.objectspace.paths.path_is_defined(auto_freeze_variable): + msg = _(f'the variable "{variable.name}" is auto_freeze but there is no variable "{auto_freeze_variable}"') + raise DictConsistencyError(msg, 81, variable.xmlfiles) new_condition = self.objectspace.condition(variable.xmlfiles) new_condition.name = 'auto_frozen_if_in' new_condition.namespace = variable.namespace - new_condition.source = self.objectspace.rougailconfig['auto_freeze_variable'] + new_condition.source = auto_freeze_variable new_param = self.objectspace.param(variable.xmlfiles) new_param.text = True new_condition.param = [new_param] diff --git a/tests/dictionaries/80load_autofreeze_no_variable/00-base.xml b/tests/dictionaries/80load_autofreeze_no_variable/00-base.xml new file mode 100644 index 000000000..97339cfa5 --- /dev/null +++ b/tests/dictionaries/80load_autofreeze_no_variable/00-base.xml @@ -0,0 +1,8 @@ + + + + + no + + + diff --git a/tests/dictionaries/80load_autofreeze_no_variable/__init__.py b/tests/dictionaries/80load_autofreeze_no_variable/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/dictionaries/80load_autofreeze_no_variable/errno_81 b/tests/dictionaries/80load_autofreeze_no_variable/errno_81 new file mode 100644 index 000000000..e69de29bb