forms: use get_variadic_url on disabled redirection (#6311)

This commit is contained in:
Frédéric Péters 2015-01-17 20:57:54 +01:00
parent 931cbe0a99
commit 0836a81691
2 changed files with 3 additions and 17 deletions

View File

@ -309,14 +309,9 @@ class FormPage(Directory):
self.check_role()
if self.formdef.is_disabled():
if self.formdef.disabled_redirection:
if re.search(r'\[.*\]', self.formdef.disabled_redirection):
try:
variables = get_publisher().substitutions.get_context_variables()
redirect_url = template.process_template(self.formdef.disabled_redirection, variables)
return redirect(redirect_url)
except ezt.EZTException:
pass
return redirect(self.formdef.disabled_redirection)
url = misc.get_variadic_url(self.formdef.disabled_redirection,
get_publisher().substitutions.get_context_variables())
return redirect(url)
else:
raise errors.AccessForbiddenError()

View File

@ -433,12 +433,3 @@ def decorate(body, response):
fd = StringIO()
template.generate(fd, vars)
return fd.getvalue()
def process_template(template_ezt, kwargs):
template = ezt.Template()
template.parse(template_ezt)
fd = StringIO()
template.generate(fd, kwargs)
return htmltext(fd.getvalue())