diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-07-30 01:19:46 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-07-30 01:19:46 +0000 |
| commit | 523132fe530f3ed19316c569351b6d0e3539c5e0 (patch) | |
| tree | d47f039c3111ed23664d53ef17ecbc3a0d747601 /docs/narr | |
| parent | baa6347612783c936c2bd081d5ec90e6c3011a02 (diff) | |
| download | pyramid-523132fe530f3ed19316c569351b6d0e3539c5e0.tar.gz pyramid-523132fe530f3ed19316c569351b6d0e3539c5e0.tar.bz2 pyramid-523132fe530f3ed19316c569351b6d0e3539c5e0.zip | |
cm
Diffstat (limited to 'docs/narr')
| -rw-r--r-- | docs/narr/urldispatch.rst | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index 59bcde13f..3c7555636 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -258,6 +258,24 @@ It will not match the following patterns however: foo/1/2/ -> No match (trailing slash) bar/abc/def -> First segment literal mismatch +The match for a segment replacement marker in a segment will be done +only up to the first non-alphanumeric character in the segment in the +pattern. So, for instance, if this route pattern was used: + +.. code-block:: text + + foo/:name.html + +The literal path ``/foo/biz.html`` will match the above route pattern, +and the match result will be ``{'name':u'biz'}``. However, the +literal path ``/foo/biz`` will not match, because it does not contain +a literal ``.html`` at the end of the segment represented by +``:name.html`` (it only contains ``biz``, not ``biz.html``). + +This does not mean, however, that you can use two segment replacement +markers in the same segment. For instance, ``/:foo:bar`` is a +nonsensical route pattern. It will never match anything. + Note that values representing path segments matched with a ``:segment`` match will be url-unquoted and decoded from UTF-8 into Unicode within the matchdict. So for instance, the following @@ -294,8 +312,8 @@ 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')} + foo/1/2/ -> {'baz':'1', 'bar':'2', 'fizzle':()} + foo/abc/def/a/b/c -> {'baz':'abc', 'bar':'def', 'fizzle':('a', 'b', 'c')} Note that when a ``*stararg`` remainder match is matched, the value put into the matchdict is turned into a tuple of path segments |
