Skip to content
Myr

Fixed stream_with_context if decorated function has parameters

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

authored by Shipeng Feng · committed by David Lord · parent 9a80fe6 · Browse files · 2 files+4 added−4 removed
This commit

State

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

Diff stats

2 files+4 added−4 removed

  • tests:+3 added−3 removed
  • other:+1 added−1 removed

2 files+4 added−4 removed

modified:flask/helpers.py+1 added-1 removed
99 unmodified lines
100 try:101 gen = iter(generator_or_function)102 except TypeError:103 def decorator(*args, **kwargs):104 gen = generator_or_function()104 gen = generator_or_function(*args, **kwargs)105 return stream_with_context(gen)106 return update_wrapper(decorator, generator_or_function)107108 def generator():
804 unmodified lines
modified:tests/test_helpers.py+3 added-3 removed
681 unmodified lines
682 app.testing = True683 @app.route('/')684 def index():685 @flask.stream_with_context686 def generate():687 yield 'Hello '686 def generate(hello):687 yield hello688 yield flask.request.args['name']689 yield '!'690 return flask.Response(generate())690 return flask.Response(generate('Hello '))691 c = app.test_client()692 rv = c.get('/?name=World')693 assert rv.data == b'Hello World!'694
26 unmodified lines