diff --git a/flask/templating.py b/flask/templating.py index 0c54cbd4..59fd988e 100644 --- a/flask/templating.py +++ b/flask/templating.py @@ -101,20 +101,9 @@ class DispatchingJinjaLoader(BaseLoader): def _render(template, context, app): - """Renders the template and fires signals. - - It is possible to override render template in the before_render_template signal. - It can be done only if exactly one receiver and it return not None result.""" - - brt_resp = before_render_template.send(app, template=template, context=context) - - overrides = [rv for _, rv in brt_resp if rv is not None] - if len(overrides) == 1: - return overrides[0] - elif len(overrides) > 1: - raise RuntimeError('More than one before_render_template signal ' - 'returned data') + """Renders the template and fires the signal""" + before_render_template.send(app, template=template, context=context) rv = template.render(context) template_rendered.send(app, template=template, context=context) return rv diff --git a/tests/test_signals.py b/tests/test_signals.py index e85c66e6..b687b6e8 100644 --- a/tests/test_signals.py +++ b/tests/test_signals.py @@ -70,26 +70,6 @@ def test_before_render_template(): finally: flask.before_render_template.disconnect(record, app) -def test_before_render_template_signal_not_None_result_render_skip_render_template(): - app = flask.Flask(__name__) - - @app.route('/') - def index(): - return flask.render_template('simple_template.html', whiskey=42) - - recorded = [] - - def record(sender, template, context): - recorded.append((template, context)) - return 'Not template string' - - flask.before_render_template.connect(record, app) - try: - rv = app.test_client().get('/') - assert rv.data == b'Not template string' - finally: - flask.before_render_template.disconnect(record, app) - def test_request_signals(): app = flask.Flask(__name__) calls = []