diff options
| -rw-r--r-- | CHANGES.txt | 4 | ||||
| -rw-r--r-- | CONTRIBUTORS.txt | 2 | ||||
| -rw-r--r-- | README.rst | 8 | ||||
| -rw-r--r-- | RELEASING.txt | 20 | ||||
| -rw-r--r-- | docs/narr/project.rst | 2 | ||||
| -rw-r--r-- | docs/quick_tour.rst | 4 | ||||
| -rw-r--r-- | docs/quick_tutorial/cookiecutters.rst | 2 | ||||
| -rw-r--r-- | docs/tutorials/modwsgi/index.rst | 2 | ||||
| -rw-r--r-- | docs/tutorials/wiki/installation.rst | 4 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/installation.rst | 4 | ||||
| -rw-r--r-- | pyramid/router.py | 14 | ||||
| -rw-r--r-- | pyramid/tests/test_router.py | 27 |
12 files changed, 74 insertions, 19 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index c21508a70..fc1d5ae25 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -9,6 +9,10 @@ unreleased resulting source files in tutorials. See https://github.com/Pylons/pyramid/issues/2548 +- Update RELEASING.txt for updating cookiecutters. Change cookiecutter URLs to + use shortcut. + See: https://github.com/Pylons/pyramid/issues/3042 + 1.9a2 (2017-05-09) ================== diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 2e49a193a..cbee08d0d 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -300,3 +300,5 @@ Contributors - Aleph Melo, 2017/04/16 - Jeremy(Ching-Rui) Chen, 2017/04/19 + +- Fang-Pen Lin, 2017/05/22 diff --git a/README.rst b/README.rst index 5f42115df..0429c36b5 100644 --- a/README.rst +++ b/README.rst @@ -3,15 +3,11 @@ Pyramid .. image:: https://travis-ci.org/Pylons/pyramid.png?branch=1.9-branch :target: https://travis-ci.org/Pylons/pyramid - :alt: master Travis CI Status + :alt: 1.9-branch Travis CI Status .. image:: https://readthedocs.org/projects/pyramid/badge/?version=1.9-branch :target: http://docs.pylonsproject.org/projects/pyramid/en/1.9-branch/ - :alt: Master Documentation Status - -.. image:: https://readthedocs.org/projects/pyramid/badge/?version=1.9-branch - :target: http://docs.pylonsproject.org/projects/pyramid/en/1.9-branch/ - :alt: Latest Documentation Status + :alt: 1.9-branch Documentation Status .. image:: https://img.shields.io/badge/irc-freenode-blue.svg :target: https://webchat.freenode.net/?channels=pyramid diff --git a/RELEASING.txt b/RELEASING.txt index 58ebb2fb3..9f7db457e 100644 --- a/RELEASING.txt +++ b/RELEASING.txt @@ -38,6 +38,14 @@ Prepare new release branch $ ./scaffoldtests.sh +- For each ``pyramid-cookiecutter-*``, make a new branch off "master" with the + same name to align with the new Pyramid release branch name. + +- In the docs, update the ``cookiecutter`` command with the new branch name, + for example, ``cookiecutter gh:Pylons/pyramid-cookiecutter-starter --checkout + x.y-branch``. A search for ``cookiecutter gh:Pylons/pyramid-cookiecutter-`` + should return all instances to be updated. + - Ensure all features of the release are documented (audit CHANGES.txt or communicate with contributors). @@ -48,8 +56,8 @@ Prepare new release branch include a link under "Bug Fix Releases" to the minor feature changes in CHANGES.txt. -- Update README.rst to use correct versions of badges and URLs according to - each branch and context, i.e., RTD "latest" == GitHub/Travis "1.x-branch". +- Update README.rst to use correct versions of badges, URLs, and ALT option + according to the new release branch name. - Update whatsnew-X.X.rst in docs to point at change log entries for individual releases if applicable. @@ -96,6 +104,14 @@ Prepare master for further development (major releases only) - Change setup.py version to the next version number. +- Update README.rst to use correct versions of badges, URLs, and ALT option + for "master" instead of the major release version. + +- In the docs, update the ``cookiecutter`` command with ``master``, + for example, ``cookiecutter gh:Pylons/pyramid-cookiecutter-starter --checkout + master``. A search for ``cookiecutter gh:Pylons/pyramid-cookiecutter-`` + should return all instances to be updated. + Update previous version (final releases only) --------------------------------------------- diff --git a/docs/narr/project.rst b/docs/narr/project.rst index a150afc6b..f542eae86 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -85,7 +85,7 @@ On all platforms, generate a project using cookiecutter. .. code-block:: bash - $ cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter + $ cookiecutter gh:Pylons/pyramid-cookiecutter-starter --checkout 1.9-branch If prompted for the first item, accept the default ``yes`` by hitting return. diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst index 1265012ab..f3a0a27b8 100644 --- a/docs/quick_tour.rst +++ b/docs/quick_tour.rst @@ -510,7 +510,7 @@ Let's use the cookiecutter ``pyramid-cookiecutter-starter`` to create a starter .. code-block:: bash - $ $VENV/bin/cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter + $ $VENV/bin/cookiecutter gh:Pylons/pyramid-cookiecutter-starter --checkout 1.9-branch If prompted for the first item, accept the default ``yes`` by hitting return. @@ -866,7 +866,7 @@ Pyramid and SQLAlchemy are great friends. That friendship includes a cookiecutte .. code-block:: bash $ cd ~ - $ env/bin/cookiecutter https://github.com/Pylons/pyramid-cookiecutter-alchemy + $ env/bin/cookiecutter gh:Pylons/pyramid-cookiecutter-alchemy --checkout 1.9-branch If prompted for the first item, accept the default ``yes`` by hitting return. diff --git a/docs/quick_tutorial/cookiecutters.rst b/docs/quick_tutorial/cookiecutters.rst index 337a5c535..0f2a24816 100644 --- a/docs/quick_tutorial/cookiecutters.rst +++ b/docs/quick_tutorial/cookiecutters.rst @@ -28,7 +28,7 @@ Steps .. code-block:: bash - $ $VENV/bin/cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter + $ $VENV/bin/cookiecutter gh:Pylons/pyramid-cookiecutter-starter --checkout 1.9-branch If prompted for the first item, accept the default ``yes`` by hitting return. diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst index 170f2ebc8..8df432434 100644 --- a/docs/tutorials/modwsgi/index.rst +++ b/docs/tutorials/modwsgi/index.rst @@ -39,7 +39,7 @@ specific path information for commands and files. .. code-block:: bash $ cd ~ - $ cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter + $ cookiecutter gh:Pylons/pyramid-cookiecutter-starter --checkout 1.9-branch If prompted for the first item, accept the default ``yes`` by hitting return. diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst index de057b1cc..3e7434bd7 100644 --- a/docs/tutorials/wiki/installation.rst +++ b/docs/tutorials/wiki/installation.rst @@ -31,7 +31,7 @@ On UNIX .. code-block:: bash $ cd ~ - $ cookiecutter https://github.com/Pylons/pyramid-cookiecutter-zodb + $ cookiecutter gh:Pylons/pyramid-cookiecutter-zodb --checkout 1.9-branch On Windows ^^^^^^^^^^ @@ -39,7 +39,7 @@ On Windows .. code-block:: doscon c:\> cd \ - c:\> cookiecutter https://github.com/Pylons/pyramid-cookiecutter-zodb + c:\> cookiecutter gh:Pylons/pyramid-cookiecutter-zodb --checkout 1.9-branch On all operating systems ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index c61d4360d..56197900c 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -43,7 +43,7 @@ On UNIX .. code-block:: bash $ cd ~ - $ cookiecutter https://github.com/Pylons/pyramid-cookiecutter-alchemy + $ cookiecutter gh:Pylons/pyramid-cookiecutter-alchemy --checkout 1.9-branch On Windows ^^^^^^^^^^ @@ -51,7 +51,7 @@ On Windows .. code-block:: doscon c:\> cd \ - c:\> cookiecutter https://github.com/Pylons/pyramid-cookiecutter-alchemy + c:\> cookiecutter gh:Pylons/pyramid-cookiecutter-alchemy --checkout 1.9-branch On all operating systems ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/pyramid/router.py b/pyramid/router.py index 8b7b7b6bc..7f3f9fbea 100644 --- a/pyramid/router.py +++ b/pyramid/router.py @@ -1,3 +1,4 @@ +import sys from zope.interface import ( implementer, providedBy, @@ -24,6 +25,7 @@ from pyramid.events import ( BeforeTraversal, ) +from pyramid.compat import reraise from pyramid.httpexceptions import HTTPNotFound from pyramid.request import Request from pyramid.view import _call_view @@ -252,7 +254,15 @@ class Router(object): response = self.execution_policy(environ, self) return response(environ, start_response) - def default_execution_policy(environ, router): request = router.make_request(environ) - return router.invoke_request(request) + try: + return router.invoke_request(request) + except Exception: + exc_info = sys.exc_info() + try: + return request.invoke_exception_view(exc_info) + except HTTPNotFound: + reraise(*exc_info) + finally: + del exc_info # avoid local ref cycle diff --git a/pyramid/tests/test_router.py b/pyramid/tests/test_router.py index a5da5c627..bd023824c 100644 --- a/pyramid/tests/test_router.py +++ b/pyramid/tests/test_router.py @@ -1284,6 +1284,33 @@ class TestRouter(unittest.TestCase): self.assertEqual(resp.status_code, 200) self.assertEqual(resp.body, b'foo') + def test_execution_policy_handles_exception(self): + from pyramid.interfaces import IViewClassifier + from pyramid.interfaces import IExceptionViewClassifier + from pyramid.interfaces import IRequest + class Exception1(Exception): + pass + class Exception2(Exception): + pass + req_iface = self._registerRouteRequest('foo') + self._connectRoute('foo', 'archives/:action/:article', None) + view = DummyView(DummyResponse(), raise_exception=Exception1) + self._registerView(view, '', IViewClassifier, req_iface, None) + exception_view1 = DummyView(DummyResponse(), + raise_exception=Exception2) + self._registerView(exception_view1, '', IExceptionViewClassifier, + IRequest, Exception1) + response = DummyResponse() + response.app_iter = ["Hello, world"] + exception_view2 = DummyView(response) + self._registerView(exception_view2, '', IExceptionViewClassifier, + IRequest, Exception2) + environ = self._makeEnviron(PATH_INFO='/archives/action1/article1') + start_response = DummyStartResponse() + router = self._makeOne() + result = router(environ, start_response) + self.assertEqual(result, ["Hello, world"]) + class DummyPredicate(object): def __call__(self, info, request): return True |
