misc: always use lazy evaluation for URL templates (#45806)
This commit is contained in:
parent
0df992678e
commit
48389550d7
|
@ -244,7 +244,7 @@ def get_structured_items(data_source, mode=None):
|
|||
return []
|
||||
url = url.strip()
|
||||
if Template.is_template_string(url):
|
||||
vars = get_publisher().substitutions.get_context_variables(mode=mode)
|
||||
vars = get_publisher().substitutions.get_context_variables(mode='lazy')
|
||||
url = get_variadic_url(url, vars)
|
||||
|
||||
request = get_request()
|
||||
|
|
|
@ -579,7 +579,7 @@ class FormPage(Directory, FormTemplateMixin):
|
|||
if self.formdef.is_disabled():
|
||||
if self.formdef.disabled_redirection:
|
||||
return misc.get_variadic_url(self.formdef.disabled_redirection,
|
||||
get_publisher().substitutions.get_context_variables())
|
||||
get_publisher().substitutions.get_context_variables(mode='lazy'))
|
||||
else:
|
||||
raise errors.AccessForbiddenError()
|
||||
return False
|
||||
|
@ -1442,7 +1442,7 @@ class RootDirectory(AccessControlled, Directory):
|
|||
|
||||
if redirect_url:
|
||||
return redirect(misc.get_variadic_url(redirect_url,
|
||||
get_publisher().substitutions.get_context_variables()))
|
||||
get_publisher().substitutions.get_context_variables(mode='lazy')))
|
||||
|
||||
template.html_top(default_org = _('Forms'))
|
||||
r = TemplateIO(html=True)
|
||||
|
|
|
@ -2122,7 +2122,7 @@ class JsonpSingleSelectWidget(Widget):
|
|||
|
||||
def get_select2_url(self):
|
||||
if Template.is_template_string(self.url):
|
||||
vars = get_publisher().substitutions.get_context_variables()
|
||||
vars = get_publisher().substitutions.get_context_variables(mode='lazy')
|
||||
# skip variables that were not set (None)
|
||||
vars = dict((x, y) for x, y in vars.items() if y is not None)
|
||||
url = misc.get_variadic_url(self.url, vars, encode_query=False)
|
||||
|
@ -2154,7 +2154,7 @@ class AutocompleteStringWidget(WcsExtraStringWidget):
|
|||
|
||||
def render_content(self):
|
||||
if Template.is_template_string(self.url):
|
||||
vars = get_publisher().substitutions.get_context_variables()
|
||||
vars = get_publisher().substitutions.get_context_variables(mode='lazy')
|
||||
# skip variables that were not set (None)
|
||||
vars = dict((x, y) for x, y in vars.items() if y is not None)
|
||||
url = misc.get_variadic_url(self.url, vars, encode_query=False)
|
||||
|
|
|
@ -146,7 +146,7 @@ class MethodDirectory(Directory):
|
|||
|
||||
if not get_request().user or not get_session().name_identifier:
|
||||
if get_cfg('saml_identities', {}).get('registration-url'):
|
||||
vars = get_publisher().substitutions.get_context_variables()
|
||||
vars = get_publisher().substitutions.get_context_variables(mode='lazy')
|
||||
vars['next_url'] = get_request().get_frontoffice_url()
|
||||
registration_url = misc.get_variadic_url(
|
||||
get_cfg('saml_identities', {}).get('registration-url'),
|
||||
|
|
|
@ -43,7 +43,7 @@ def call_webservice(url, qs_data=None, request_signature_key=None,
|
|||
|
||||
url = url.strip()
|
||||
if Template.is_template_string(url):
|
||||
variables = get_publisher().substitutions.get_context_variables()
|
||||
variables = get_publisher().substitutions.get_context_variables(mode='lazy')
|
||||
url = get_variadic_url(url, variables)
|
||||
|
||||
if not request_signature_key:
|
||||
|
|
Loading…
Reference in New Issue