diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-06-30 18:50:39 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-06-30 18:50:39 +0000 |
| commit | 8b694da88f7f1b1aa244c72801b5effa43538056 (patch) | |
| tree | 23367cd97d1302b2b7d20e6220071ecf5fec8e4a /docs/narr | |
| parent | caa5bd8f508fe031b5d19c7f114b8ced2ffa462a (diff) | |
| download | pyramid-8b694da88f7f1b1aa244c72801b5effa43538056.tar.gz pyramid-8b694da88f7f1b1aa244c72801b5effa43538056.tar.bz2 pyramid-8b694da88f7f1b1aa244c72801b5effa43538056.zip | |
document return value
Diffstat (limited to 'docs/narr')
| -rw-r--r-- | docs/narr/urldispatch.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index c6bc1df2d..2f96ca26c 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -624,6 +624,7 @@ For instance, a predicate might do some type conversion of values: match[segment_name] = int(match[segment_name]) except (TypeError, ValueError): pass + return True return predicate ymd_to_int = integers('year', 'month', 'day') @@ -631,6 +632,11 @@ For instance, a predicate might do some type conversion of values: config.add_route('num', '/:year/:month/:day', custom_predicates=(ymd_to_int,)) +Note that a conversion predicate is still a predicate so it must +return ``True`` or ``False``; a predicate that does *only* conversion, +such as the one we demonstrate above should unconditionally return +``True``. + The ``match`` dictionary passed within ``info`` to each predicate attached to a route will be the same dictionary. Therefore, when registering a custom predicate which modifies the ``match`` dict, the |
