summaryrefslogtreecommitdiff
path: root/docs/narr/hybrid.rst
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2011-04-19 01:32:28 -0500
committerMichael Merickel <michael@merickel.org>2011-04-20 05:05:40 -0500
commita1d8c03490bcd7cb00372170c4e9c67ea9af5ce3 (patch)
treef329cbeb0896978bc3e42cba543dece0e0e5c73e /docs/narr/hybrid.rst
parent99d2d26e9c817b6a7f59bfe0f367d76438287ec7 (diff)
downloadpyramid-a1d8c03490bcd7cb00372170c4e9c67ea9af5ce3.tar.gz
pyramid-a1d8c03490bcd7cb00372170c4e9c67ea9af5ce3.tar.bz2
pyramid-a1d8c03490bcd7cb00372170c4e9c67ea9af5ce3.zip
Converting docs to deprecate view parameters in config.add_route.
Diffstat (limited to 'docs/narr/hybrid.rst')
-rw-r--r--docs/narr/hybrid.rst30
1 files changed, 15 insertions, 15 deletions
diff --git a/docs/narr/hybrid.rst b/docs/narr/hybrid.rst
index 780cb0975..d66ad59df 100644
--- a/docs/narr/hybrid.rst
+++ b/docs/narr/hybrid.rst
@@ -41,15 +41,15 @@ configuration:
# config is an instance of pyramid.config.Configurator
- config.add_route('foobar', '{foo}/{bar}', view='myproject.views.foobar')
- config.add_route('bazbuz', '{baz}/{buz}', view='myproject.views.bazbuz')
+ config.add_route('foobar', '{foo}/{bar}')
+ config.add_route('bazbuz', '{baz}/{buz}')
-Each :term:`route` typically corresponds to a single view callable,
-and when that route is matched during a request, the view callable
-named by the ``view`` attribute is invoked.
+ config.add_view('myproject.views.foobar', route_name='foobar')
+ config.add_view('myproject.views.bazbuz', route_name='bazbuz')
-Typically, an application that uses only URL dispatch won't perform any calls
-to :meth:`pyramid.config.Configurator.add_view` in its startup code.
+Each :term:`route` corresponds to one or more view callables,
+and when that route is matched during a request, :term:`view lookup` is used
+to match the request to one of the view callables.
Traversal Only
~~~~~~~~~~~~~~
@@ -196,12 +196,9 @@ remainder becomes the path used to perform traversal.
The ``*remainder`` route pattern syntax is explained in more
detail within :ref:`route_pattern_syntax`.
-Note that unlike the examples provided within :ref:`urldispatch_chapter`, the
-``add_route`` configuration statement named previously does not pass a
-``view`` argument. This is because a hybrid mode application relies on
-:term:`traversal` to do :term:`resource location` and :term:`view lookup`
-instead of invariably invoking a specific view callable named directly within
-the matched route's configuration.
+A hybrid mode application relies more heavily on :term:`traversal` to do
+:term:`resource location` and :term:`view lookup` than most examples indicate
+within :ref:`urldispatch_chapter`.
Because the pattern of the above route ends with ``*traverse``, when this
route configuration is matched during a request, :app:`Pyramid` will attempt
@@ -442,8 +439,8 @@ commonly in route declarations that look like this:
.. code-block:: python
:linenos:
- config.add_route('static', '/static/*subpath',
- view='mypackage.views.static_view')
+ config.add_route('static', '/static/*subpath')
+ config.add_view('mypackage.views.static_view', route_name='static')
Where ``mypackage.views.static_view`` is an instance of
:class:`pyramid.view.static`. This effectively tells the static helper to
@@ -458,6 +455,9 @@ application. We'll detail them here.
Registering a Default View for a Route That Has a ``view`` Attribute
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. note:: As of :app:`Pyramid` 1.1 this issue is deprecated along with
+ the ability to add views directly to the :term:`route configuration`.
+
It is an error to provide *both* a ``view`` argument to a :term:`route
configuration` *and* a :term:`view configuration` which names a
``route_name`` that has no ``name`` value or the empty ``name`` value. For