forked from orbit-oss/flask
Merge branch '0.12-maintenance'
This commit is contained in:
commit
de555c82ce
3 changed files with 24 additions and 1 deletions
5
CHANGES
5
CHANGES
|
|
@ -18,7 +18,7 @@ Major release, unreleased
|
|||
Version 0.12.1
|
||||
--------------
|
||||
|
||||
Bugfix release, unreleased
|
||||
Bugfix release, released on March 31st 2017
|
||||
|
||||
- Prevent `flask run` from showing a NoAppException when an ImportError occurs
|
||||
within the imported application module.
|
||||
|
|
@ -26,6 +26,9 @@ Bugfix release, unreleased
|
|||
``#2118``.
|
||||
- Use the ``SERVER_NAME`` config if it is present as default values for
|
||||
``app.run``. ``#2109``, ``#2152``
|
||||
- Call `ctx.auto_pop` with the exception object instead of `None`, in the
|
||||
event that a `BaseException` such as `KeyboardInterrupt` is raised in a
|
||||
request handler.
|
||||
|
||||
Version 0.12
|
||||
------------
|
||||
|
|
|
|||
|
|
@ -1991,6 +1991,9 @@ class Flask(_PackageBoundObject):
|
|||
except Exception as e:
|
||||
error = e
|
||||
response = self.handle_exception(e)
|
||||
except:
|
||||
error = sys.exc_info()[1]
|
||||
raise
|
||||
return response(environ, start_response)
|
||||
finally:
|
||||
if self.should_ignore_error(error):
|
||||
|
|
|
|||
|
|
@ -791,6 +791,23 @@ def test_error_handling_processing():
|
|||
assert resp.data == b'internal server error'
|
||||
|
||||
|
||||
def test_baseexception_error_handling():
|
||||
app = flask.Flask(__name__)
|
||||
app.config['LOGGER_HANDLER_POLICY'] = 'never'
|
||||
|
||||
@app.route('/')
|
||||
def broken_func():
|
||||
raise KeyboardInterrupt()
|
||||
|
||||
with app.test_client() as c:
|
||||
with pytest.raises(KeyboardInterrupt):
|
||||
c.get('/')
|
||||
|
||||
ctx = flask._request_ctx_stack.top
|
||||
assert ctx.preserved
|
||||
assert type(ctx._preserved_exc) is KeyboardInterrupt
|
||||
|
||||
|
||||
def test_before_request_and_routing_errors():
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue