Skip to content
Myr

Merge branch '0.10-maintenance'

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

authored by Armin Ronacher · committed by Armin Ronacher · parents c938771, 141a553 · Browse files · 3 files+26 added−2 removed
This commit

State

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

Diff stats

3 files+26 added−2 removed

  • other:+26 added−2 removed

3 files+26 added−2 removed

modified:flask/testsuite/basic.py+22 added-1 removed
13 unmodified lines
14import flask15import pickle16import unittest17from datetime import datetime18from threading import Thread18from threading import Thread, Condition19from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning20from flask._compat import text_type21from werkzeug.exceptions import BadRequest, NotFound22from werkzeug.http import parse_date
1071 unmodified lines
1094 c.get('/')1095 self.assert_equal(got, [42])1096 self.assert_true(app.got_first_request)10971098 def test_before_first_request_functions_concurrent(self):1099 got = []1100 app = flask.Flask(__name__)1101 cv = Condition()1102 @app.before_first_request1103 def foo():1104 with cv:1105 cv.wait()1106 got.append(42)1107 c = app.test_client()1108 def get_and_assert():1109 with cv:1110 cv.notify()1111 c.get("/")1112 self.assert_equal(got, [42])1113 t = Thread(target=get_and_assert)1114 t.start()1115 get_and_assert()1116 t.join()1117 self.assert_true(app.got_first_request)11181119 def test_routing_redirect_debugging(self):1120 app = flask.Flask(__name__)1121 app.debug = True1122 @app.route('/foo/', methods=['GET', 'POST'])
233 unmodified lines
modified:flask/app.py+1 added-1 removed
1489 unmodified lines
1490 return1491 with self._before_request_lock:1492 if self._got_first_request:1493 return1494 self._got_first_request = True1494 for func in self.before_first_request_funcs:1495 func()1496 self._got_first_request = True14971498 def make_default_options_response(self):1499 """This method is called to create the default `OPTIONS` response.1500 This can be changed through subclassing to change the default
346 unmodified lines
modified:CHANGES+3 added
33 unmodified lines
34- Made `@before_first_request` into a decorator as intended.35- Fixed an etags bug when sending a file streams with a name.36- Fixed `send_from_directory` not expanding to the application root path37 correctly.38- Changed logic of before first request handlers to flip the flag after39 invoking. This will allow some uses that are potentially dangerous but40 should probably be permitted.4142Version 0.10.143--------------44
457 unmodified lines