auto_freeze is now allowed in extra

This commit is contained in:
Emmanuel Garette 2021-03-19 10:15:34 +01:00
parent 63e679036b
commit d895c46729

View file

@ -50,6 +50,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
return return
self.target_is_uniq = False self.target_is_uniq = False
self.only_variable = False self.only_variable = False
self.allow_function = False
self.convert_target(self.objectspace.space.constraints.condition) self.convert_target(self.objectspace.space.constraints.condition)
self.check_condition_optional() self.check_condition_optional()
self.convert_condition_source() self.convert_condition_source()
@ -74,9 +75,9 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
for variable in self.get_variables(): for variable in self.get_variables():
if not variable.auto_freeze and not variable.auto_save: if not variable.auto_freeze and not variable.auto_save:
continue continue
if variable.namespace != self.objectspace.rougailconfig['variable_namespace']: #if variable.namespace != self.objectspace.rougailconfig['variable_namespace']:
msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"') # msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"')
raise DictConsistencyError(msg, 49, variable.xmlfiles) # raise DictConsistencyError(msg, 49, variable.xmlfiles)
variable.force_store_value = True variable.force_store_value = True
if variable.auto_save: if variable.auto_save:
continue continue
@ -89,7 +90,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
new_condition.param = [new_param] new_condition.param = [new_param]
new_target = self.objectspace.target(variable.xmlfiles) new_target = self.objectspace.target(variable.xmlfiles)
new_target.type = 'variable' new_target.type = 'variable'
new_target.name = variable.name new_target.name = variable.path
new_condition.target = [new_target] new_condition.target = [new_target]
if not hasattr(self.objectspace.space, 'constraints'): if not hasattr(self.objectspace.space, 'constraints'):
self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles) self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles)