general: update formdata in context for lazy evaluation (#47715)

This commit is contained in:
Frédéric Péters 2020-11-28 18:47:55 +01:00
parent d0fd141fb1
commit b525483e36
1 changed files with 11 additions and 0 deletions

View File

@ -1972,6 +1972,10 @@ class PageCondition(Condition):
self.id_dict_var = id_dict_var
def get_substitution_variables(self):
return {}
def get_static_substitution_variables(self):
# only for backward compatibility with python evaluations
return form_live_data
def __eq__(self, other):
@ -1986,6 +1990,13 @@ class PageCondition(Condition):
# ie do nothing on first page condition
get_publisher().substitutions.feed(ConditionVars(id(dict_vars)))
# alter top-of-stack formdata with data from submitted form
from wcs.formdata import FormData
for source in reversed(get_publisher().substitutions.sources):
if isinstance(source, FormData):
source.data.update(dict_vars)
break
data = super(PageCondition, self).get_data()
# 2) add live data as var_ variables for local evaluation only, for
# backward compatibility. They are not added globally as they would