| | |
| | | For backwards compatibility purposes (as of :app:`Pyramid` 1.0), a |
| | | ``path`` keyword argument passed to this function will be used to |
| | | represent the pattern value if the ``pattern`` argument is |
| | | ``None``. If both ``path`` and ``pattern`` are passed, ``pattern`` |
| | | wins. |
| | | ``None``. If both ``path`` and ``pattern`` are passed, |
| | | ``pattern`` wins. |
| | | |
| | | xhr |
| | | |
| | |
| | | if custom_predicates: |
| | | warnings.warn( |
| | | ( |
| | | 'The "custom_predicates" argument to Configurator.add_route ' |
| | | 'is deprecated as of Pyramid 1.5. Use ' |
| | | '"config.add_route_predicate" and use the registered ' |
| | | 'The "custom_predicates" argument to ' |
| | | 'Configurator.add_route is deprecated as of Pyramid 1.5. ' |
| | | 'Use "config.add_route_predicate" and use the registered ' |
| | | 'route predicate as a predicate argument to add_route ' |
| | | 'instead. See "Adding A Third Party View, Route, or ' |
| | | 'Subscriber Predicate" in the "Hooks" chapter of the ' |
| | |
| | | if '*' in accept: |
| | | warnings.warn( |
| | | ( |
| | | 'Passing a media range to the "accept" argument of ' |
| | | 'Configurator.add_route is deprecated as of Pyramid ' |
| | | '1.10. Use a list of explicit media types.' |
| | | 'Passing a media range to the "accept" argument ' |
| | | 'of Configurator.add_route is deprecated as of ' |
| | | 'Pyramid 1.10. Use a list of explicit media types.' |
| | | ), |
| | | DeprecationWarning, |
| | | stacklevel=3, |
| | |
| | | |
| | | When the context exits, the ``route_prefix`` is reset to the original. |
| | | |
| | | ``route_prefix`` is a string suitable to be used as a route prefix, |
| | | or ``None``. |
| | | |
| | | Example Usage: |
| | | |
| | | >>> config = Configurator() |
| | | >>> with config.route_prefix_context('foo'): |
| | | ... config.add_route('bar', '/bar') |
| | | .. code-block:: python |
| | | |
| | | Arguments |
| | | |
| | | route_prefix |
| | | |
| | | A string suitable to be used as a route prefix, or ``None``. |
| | | config = Configurator() |
| | | with config.route_prefix_context('foo'): |
| | | config.add_route('bar', '/bar') |
| | | |
| | | .. versionadded:: 1.10 |
| | | """ |
| | | |
| | | """ |
| | | original_route_prefix = self.route_prefix |
| | | |
| | | if route_prefix is None: |