Projet

Général

Profil

0003-general-update-formdata-in-context-for-lazy-evaluati.patch

Frédéric Péters, 28 novembre 2020 19:42

Télécharger (1,55 ko)

Voir les différences:

Subject: [PATCH 3/3] general: update formdata in context for lazy evaluation
 (#47715)

 wcs/fields.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
wcs/fields.py
1968 1968
                self.id_dict_var = id_dict_var
1969 1969

  
1970 1970
            def get_substitution_variables(self):
1971
                return {}
1972

  
1973
            def get_static_substitution_variables(self):
1974
                # only for backward compatibility with python evaluations
1971 1975
                return form_live_data
1972 1976

  
1973 1977
            def __eq__(self, other):
......
1982 1986
            # ie do nothing on first page condition
1983 1987
            get_publisher().substitutions.feed(ConditionVars(id(dict_vars)))
1984 1988

  
1989
            # alter top-of-stack formdata with data from submitted form
1990
            from wcs.formdata import FormData
1991
            for source in reversed(get_publisher().substitutions.sources):
1992
                if isinstance(source, FormData):
1993
                    source.data.update(dict_vars)
1994
                    break
1995

  
1985 1996
        data = super(PageCondition, self).get_data()
1986 1997
        # 2) add live data as var_ variables for local evaluation only, for
1987 1998
        # backward compatibility. They are not added globally as they would
1988
-