diff options
| author | Michael Merickel <michael@merickel.org> | 2019-06-10 23:07:39 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-10 23:07:39 -0500 |
| commit | eef67d22e2648145674dfc329fe165d56d4e31c7 (patch) | |
| tree | e3fc89b3c5038e69b668f7bcb14cc4f4be280995 | |
| parent | 0a3f842daadde4ea0f0c5bc007d9a81adb8e5a18 (diff) | |
| parent | f9813e050988e69b3b972bcc4495671bde2dafa7 (diff) | |
| download | pyramid-eef67d22e2648145674dfc329fe165d56d4e31c7.tar.gz pyramid-eef67d22e2648145674dfc329fe165d56d4e31c7.tar.bz2 pyramid-eef67d22e2648145674dfc329fe165d56d4e31c7.zip | |
Merge pull request #3496 from mmerickel/no-reinvoke-excview
do not reinvoke exception views if an exception hits the execution policy
| -rw-r--r-- | src/pyramid/router.py | 5 | ||||
| -rw-r--r-- | tests/test_router.py | 5 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/pyramid/router.py b/src/pyramid/router.py index 19641aecd..fa1a9ebf7 100644 --- a/src/pyramid/router.py +++ b/src/pyramid/router.py @@ -273,7 +273,4 @@ class Router(object): def default_execution_policy(environ, router): with router.request_context(environ) as request: - try: - return router.invoke_request(request) - except Exception: - return request.invoke_exception_view(reraise=True) + return router.invoke_request(request) diff --git a/tests/test_router.py b/tests/test_router.py index 3e66757f6..722f4286c 100644 --- a/tests/test_router.py +++ b/tests/test_router.py @@ -1561,7 +1561,7 @@ class TestRouter(unittest.TestCase): self.assertEqual(resp.status_code, 200) self.assertEqual(resp.body, b'foo') - def test_execution_policy_handles_exception(self): + def test_execution_policy_bubbles_exception(self): from pyramid.interfaces import IViewClassifier from pyramid.interfaces import IExceptionViewClassifier from pyramid.interfaces import IRequest @@ -1591,8 +1591,7 @@ class TestRouter(unittest.TestCase): environ = self._makeEnviron(PATH_INFO='/archives/action1/article1') start_response = DummyStartResponse() router = self._makeOne() - result = router(environ, start_response) - self.assertEqual(result, ["Hello, world"]) + self.assertRaises(Exception2, lambda: router(environ, start_response)) def test_request_context_with_statement(self): from pyramid.threadlocal import get_current_request |
