Projet

Général

Profil

0001-misc-always-use-lazy-evaluation-for-URL-templates-45.patch

Frédéric Péters, 15 août 2020 14:00

Télécharger (4,43 ko)

Voir les différences:

Subject: [PATCH] misc: always use lazy evaluation for URL templates (#45806)

 wcs/data_sources.py     | 2 +-
 wcs/forms/root.py       | 4 ++--
 wcs/qommon/form.py      | 4 ++--
 wcs/qommon/ident/idp.py | 2 +-
 wcs/wscalls.py          | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)
wcs/data_sources.py
241 241
            return []
242 242
        url = url.strip()
243 243
        if Template.is_template_string(url):
244
            vars = get_publisher().substitutions.get_context_variables(mode=mode)
244
            vars = get_publisher().substitutions.get_context_variables(mode='lazy')
245 245
            url = get_variadic_url(url, vars)
246 246

  
247 247
        request = get_request()
wcs/forms/root.py
568 568
        if self.formdef.is_disabled():
569 569
            if self.formdef.disabled_redirection:
570 570
                return misc.get_variadic_url(self.formdef.disabled_redirection,
571
                        get_publisher().substitutions.get_context_variables())
571
                        get_publisher().substitutions.get_context_variables(mode='lazy'))
572 572
            else:
573 573
                raise errors.AccessForbiddenError()
574 574
        return False
......
1420 1420

  
1421 1421
        if redirect_url:
1422 1422
            return redirect(misc.get_variadic_url(redirect_url,
1423
                get_publisher().substitutions.get_context_variables()))
1423
                get_publisher().substitutions.get_context_variables(mode='lazy')))
1424 1424

  
1425 1425
        template.html_top(default_org = _('Forms'))
1426 1426
        r = TemplateIO(html=True)
wcs/qommon/form.py
2118 2118

  
2119 2119
    def get_select2_url(self):
2120 2120
        if Template.is_template_string(self.url):
2121
            vars = get_publisher().substitutions.get_context_variables()
2121
            vars = get_publisher().substitutions.get_context_variables(mode='lazy')
2122 2122
            # skip variables that were not set (None)
2123 2123
            vars = dict((x, y) for x, y in vars.items() if y is not None)
2124 2124
            url = misc.get_variadic_url(self.url, vars, encode_query=False)
......
2150 2150

  
2151 2151
    def render_content(self):
2152 2152
        if Template.is_template_string(self.url):
2153
            vars = get_publisher().substitutions.get_context_variables()
2153
            vars = get_publisher().substitutions.get_context_variables(mode='lazy')
2154 2154
            # skip variables that were not set (None)
2155 2155
            vars = dict((x, y) for x, y in vars.items() if y is not None)
2156 2156
            url = misc.get_variadic_url(self.url, vars, encode_query=False)
wcs/qommon/ident/idp.py
146 146

  
147 147
        if not get_request().user or not get_session().name_identifier:
148 148
            if get_cfg('saml_identities', {}).get('registration-url'):
149
                vars = get_publisher().substitutions.get_context_variables()
149
                vars = get_publisher().substitutions.get_context_variables(mode='lazy')
150 150
                vars['next_url'] = get_request().get_frontoffice_url()
151 151
                registration_url = misc.get_variadic_url(
152 152
                                get_cfg('saml_identities', {}).get('registration-url'),
wcs/wscalls.py
43 43

  
44 44
    url = url.strip()
45 45
    if Template.is_template_string(url):
46
        variables = get_publisher().substitutions.get_context_variables()
46
        variables = get_publisher().substitutions.get_context_variables(mode='lazy')
47 47
        url = get_variadic_url(url, variables)
48 48

  
49 49
    if not request_signature_key:
50
-