Skip to content
Myr

template overrides handling changed

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Alexander Pantyukhin · committed by Markus Unterwaditzer · parent eae37b5 · Browse files · 1 file+6 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−5 removed

  • other:+6 added−5 removed

1 file+6 added−5 removed

modified:flask/templating.py+6 added-5 removed
106 unmodified lines
107 It can be done only if exactly one receiver and it return not None result."""108109 brt_resp = before_render_template.send(app, template=template, context=context)110 111 if len(brt_resp) == 1:112 first_resp = brt_resp[0]111 overrides = [rv for _, rv in brt_resp if rv is not None]112 if len(overrides) == 1:113 return overrides[0]114 elif len(overrides) > 1:115 raise RuntimeError('More than one before_render_template signal '116 'returned data')117114 if len(first_resp) == 2 and first_resp[1] is not None:115 return first_resp[1]116118 rv = template.render(context)119 template_rendered.send(app, template=template, context=context)120 return rv121
30 unmodified lines