From ebb56ebe4dd0cbecd6d19b5741ddf52c96a0176d Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 4 Nov 2018 13:43:39 -0600 Subject: add changelog for #3414 --- CHANGES.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'CHANGES.rst') diff --git a/CHANGES.rst b/CHANGES.rst index 73562c003..53bf0ab60 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,6 +12,12 @@ Features documentation for more information about why this change was made. See https://github.com/Pylons/pyramid/pull/3413 +- It is now possible to declare a route to not contain a trailing slash + when it is mounted via ``config.include(..., route_prefix=...)`` or via + ``with config.route_prefix_context(...)`` by specifying a ``pattern`` of + ``''``. This change is backward incompatible, see the notes below. + See https://github.com/Pylons/pyramid/pull/3414 + Bug Fixes --------- @@ -68,6 +74,15 @@ Backward Incompatibilities documentation for more information about why this change was made. See https://github.com/Pylons/pyramid/pull/3413 +- Changed the URL generation and matching for a route with a ``pattern`` of + ``''`` when the route is mounted with a ``route_prefix`` via either + ``config.include(..., route_prefix=...)`` or + ``with config.route_prefix_context(...)``. This route will now match a bare + URL without a trailing slash. To preserve the old behavior, set the + ``pattern`` to ``'/'`` instead of the empty string and the URL will contain + a trailing slash. This only affects mounted routes using ``route_prefix``. + See https://github.com/Pylons/pyramid/pull/3414 + Documentation Changes --------------------- -- cgit v1.2.3 From dff0798e352d0afeeec2058200ac983692b606c2 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 11 Nov 2018 22:39:52 -0600 Subject: use inherit_slash=True on add_route to opt-in to no trailing slash --- CHANGES.rst | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'CHANGES.rst') diff --git a/CHANGES.rst b/CHANGES.rst index 53bf0ab60..1790bb69f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,11 +12,22 @@ Features documentation for more information about why this change was made. See https://github.com/Pylons/pyramid/pull/3413 -- It is now possible to declare a route to not contain a trailing slash - when it is mounted via ``config.include(..., route_prefix=...)`` or via - ``with config.route_prefix_context(...)`` by specifying a ``pattern`` of - ``''``. This change is backward incompatible, see the notes below. - See https://github.com/Pylons/pyramid/pull/3414 +- It is now possible to control whether a route pattern contains a trailing + slash when it is composed with a route prefix using + ``config.include(..., route_prefix=...)`` or + ``with config.route_prefix_context(...)``. This can be done by specifying + an empty pattern and setting the new argument + ``inherit_slash=True``. For example:: + + with config.route_prefix_context('/users'): + config.add_route('users', '', inherit_slash=True) + + In the example, the resulting pattern will be ``/users``. Similarly, if the + route prefix were ``/users/`` then the final pattern would be ``/users/``. + If the ``pattern`` was ``'/'``, then the final pattern would always be + ``/users/``. This new setting is only available if the pattern supplied + to ``add_route`` is the empty string (``''``). + See https://github.com/Pylons/pyramid/pull/3420 Bug Fixes --------- @@ -74,15 +85,6 @@ Backward Incompatibilities documentation for more information about why this change was made. See https://github.com/Pylons/pyramid/pull/3413 -- Changed the URL generation and matching for a route with a ``pattern`` of - ``''`` when the route is mounted with a ``route_prefix`` via either - ``config.include(..., route_prefix=...)`` or - ``with config.route_prefix_context(...)``. This route will now match a bare - URL without a trailing slash. To preserve the old behavior, set the - ``pattern`` to ``'/'`` instead of the empty string and the URL will contain - a trailing slash. This only affects mounted routes using ``route_prefix``. - See https://github.com/Pylons/pyramid/pull/3414 - Documentation Changes --------------------- -- cgit v1.2.3 From 2d32ae81abc473fb21b4bc42aec479c656693f1c Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 12 Nov 2018 18:43:20 -0600 Subject: use code blocks --- CHANGES.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'CHANGES.rst') diff --git a/CHANGES.rst b/CHANGES.rst index 1790bb69f..7772ac7e2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -17,7 +17,9 @@ Features ``config.include(..., route_prefix=...)`` or ``with config.route_prefix_context(...)``. This can be done by specifying an empty pattern and setting the new argument - ``inherit_slash=True``. For example:: + ``inherit_slash=True``. For example: + + .. code-block:: python with config.route_prefix_context('/users'): config.add_route('users', '', inherit_slash=True) -- cgit v1.2.3