Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support inherit_slash=True on add_route #3420

Merged
merged 7 commits into from
Nov 13, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
try to fix docs
mmerickel committed Nov 12, 2018
commit c8f88fe53338b2b2675ef4497d0704a1542112ec
11 changes: 6 additions & 5 deletions src/pyramid/config/routes.py
Original file line number Diff line number Diff line change
@@ -144,18 +144,19 @@ def add_route(

This argument can only be used when the ``pattern`` is an empty
string (``''``). By default, the composed route pattern will always
includes a trailing slash, but this argument provides a way to
opt-out if both, you and the integrator (the developer setting the
:term:`route prefix`), agree that the pattern should not contain
a trailing slash. For example:
include a trailing slash, but this argument provides a way to
opt-out if both, you (the developer invoking ``add_route``) and the
integrator (the developer setting the :term:`route prefix`),
agree that the pattern should not contain a trailing slash.
For example:

.. code-block:: python

with config.route_prefix_context('/users'):
config.add_route('users', '', inherit_slash=True)

In this example, the resulting route pattern will be ``/users``.
Alternatively, if the route prefix were ``/users/`` then the
Alternatively, if the route prefix were ``/users/``, then the
resulting route pattern would be ``/users/``.

.. versionadded:: 2.0