diff options
| author | Chris McDonough <chrism@plope.com> | 2018-07-02 13:52:55 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2018-07-02 13:52:55 -0400 |
| commit | 0c8ca237d1bb1ff0f6e3776a3c868edb040fa791 (patch) | |
| tree | 57498768d48ce74a753dec8f359b5646acf30655 /docs/narr/urldispatch.rst | |
| parent | 50efc321cb14d76433216783c11b9eb99a7d44c8 (diff) | |
| parent | 57a896f103c7378fb285f6594228578a5324d672 (diff) | |
| download | pyramid-0c8ca237d1bb1ff0f6e3776a3c868edb040fa791.tar.gz pyramid-0c8ca237d1bb1ff0f6e3776a3c868edb040fa791.tar.bz2 pyramid-0c8ca237d1bb1ff0f6e3776a3c868edb040fa791.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/narr/urldispatch.rst')
| -rw-r--r-- | docs/narr/urldispatch.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index 9ac01e24a..00c7bd3bf 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -1045,6 +1045,24 @@ may be added in the future. For example: config = Configurator() config.include(users_include, route_prefix='/users') +A convenience context manager exists to set the route prefix for any +:meth:`pyramid.config.Configurator.add_route` or +:meth:`pyramid.config.Configurator.include` calls within the context. + +.. code-block:: python + :linenos: + + from pyramid.config import Configurator + + def timing_include(config): + config.add_route('timing.show_times', '/times') + + def main(global_config, **settings) + config = Configurator() + with config.route_prefix_context('/timing'): + config.include(timing_include) + config.add_route('timing.average', '/average') + .. index:: single: route predicates (custom) |
