test if auto_freeze variable exists
This commit is contained in:
parent
4e3f4201fc
commit
a058d4a20d
4 changed files with 13 additions and 1 deletions
|
@ -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]
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<variables>
|
||||
<variable name="myvar" auto_freeze="True">
|
||||
<value>no</value>
|
||||
</variable>
|
||||
</variables>
|
||||
</rougail>
|
Loading…
Reference in a new issue