forked from orbit-oss/flask
template overrides handling changed
This commit is contained in:
parent
eae37b575d
commit
883f82f261
1 changed files with 6 additions and 5 deletions
|
|
@ -108,11 +108,12 @@ def _render(template, context, app):
|
||||||
|
|
||||||
brt_resp = before_render_template.send(app, template=template, context=context)
|
brt_resp = before_render_template.send(app, template=template, context=context)
|
||||||
|
|
||||||
if len(brt_resp) == 1:
|
overrides = [rv for _, rv in brt_resp if rv is not None]
|
||||||
first_resp = brt_resp[0]
|
if len(overrides) == 1:
|
||||||
|
return overrides[0]
|
||||||
if len(first_resp) == 2 and first_resp[1] is not None:
|
elif len(overrides) > 1:
|
||||||
return first_resp[1]
|
raise RuntimeError('More than one before_render_template signal '
|
||||||
|
'returned data')
|
||||||
|
|
||||||
rv = template.render(context)
|
rv = template.render(context)
|
||||||
template_rendered.send(app, template=template, context=context)
|
template_rendered.send(app, template=template, context=context)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue