diff options
Diffstat (limited to 'docs/narr/urldispatch.rst')
| -rw-r--r-- | docs/narr/urldispatch.rst | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index df7d592f9..e439c71cd 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -350,7 +350,9 @@ also capture the remainder of the URL, for example: foo/{baz}/{bar}{fizzle:.*} The above pattern will match these URLs, generating the following -matchdicts:: +matchdicts: + +.. code-block:: text foo/1/2/ -> {'baz':'1', 'bar':'2', 'fizzle':()} foo/abc/def/a/b/c -> {'baz':'abc', 'bar':'def', 'fizzle': 'a/b/c')} @@ -836,8 +838,8 @@ strings. The values will be Unicode objects. .. note:: - If no route URL pattern matches, no ``matchdict`` is attached to - the request. + If no route URL pattern matches, the ``matchdict`` object attached to the + request will be ``None``. .. index:: single: matched_route @@ -855,6 +857,11 @@ an attribute of the :term:`request` object. Thus, request. The most useful attribute of the route object is ``name``, which is the name of the route that matched. +.. note:: + + If no route URL pattern matches, the ``matched_route`` object attached to + the request will be ``None``. + Routing Examples ---------------- @@ -1141,6 +1148,7 @@ custom notfound view as the first argument to its constructor. For instance: .. code-block:: python + :linenos: from pyramid.exceptions import NotFound from pyramid.view import AppendSlashNotFoundViewFactory |
