Projet

Général

Profil

0001-misc-use-lazy-mode-for-variables-in-template-evaluat.patch

Frédéric Péters, 10 décembre 2019 07:50

Télécharger (1,79 ko)

Voir les différences:

Subject: [PATCH] misc: use lazy mode for variables in template evaluations
 (#38332)

 wcs/workflows.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
wcs/workflows.py
1880 1880
        if expression['type'] == 'text':
1881 1881
            return expression['value']
1882 1882

  
1883
        vars = get_publisher().substitutions.get_context_variables()
1883
        vars = get_publisher().substitutions.get_context_variables(
1884
                'lazy' if expression['type'] == 'template' else None)
1884 1885
        vars.update(context or {})
1885 1886

  
1886 1887
        def log_exception(exception):
......
2607 2608

  
2608 2609

  
2609 2610
def get_formdata_template_context(formdata=None):
2610
    ctx = get_publisher().substitutions.get_context_variables()
2611
    ctx = get_publisher().substitutions.get_context_variables('lazy')
2611 2612
    if formdata:
2612 2613
        ctx['url'] = formdata.get_url()
2613 2614
        ctx['url_status'] = '%sstatus' % formdata.get_url()
......
2763 2764
        if not (self.message and self.position == position and self.is_for_current_user(filled)):
2764 2765
            return ''
2765 2766

  
2766
        dict = copy.copy(get_publisher().substitutions.get_context_variables())
2767
        dict = copy.copy(get_publisher().substitutions.get_context_variables('lazy'))
2767 2768
        dict['date'] = misc.localstrftime(filled.receipt_time)
2768 2769
        dict['number'] = filled.id
2769 2770
        handling_role = filled.get_handling_role()
2770
-