summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki2/basiclayout.rst
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2011-04-19 02:50:27 -0500
committerMichael Merickel <michael@merickel.org>2011-04-20 05:05:40 -0500
commit773a370c590ed82c143aa548f55ab9472601449b (patch)
treebe6476005d80022c8a088cd77b44541ae9cd34d9 /docs/tutorials/wiki2/basiclayout.rst
parenta1d8c03490bcd7cb00372170c4e9c67ea9af5ce3 (diff)
downloadpyramid-773a370c590ed82c143aa548f55ab9472601449b.tar.gz
pyramid-773a370c590ed82c143aa548f55ab9472601449b.tar.bz2
pyramid-773a370c590ed82c143aa548f55ab9472601449b.zip
Upgraded the url dispatch tutorials to use add_view.
Diffstat (limited to 'docs/tutorials/wiki2/basiclayout.rst')
-rw-r--r--docs/tutorials/wiki2/basiclayout.rst37
1 files changed, 21 insertions, 16 deletions
diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst
index 0dbcf6684..bb39a686d 100644
--- a/docs/tutorials/wiki2/basiclayout.rst
+++ b/docs/tutorials/wiki2/basiclayout.rst
@@ -81,28 +81,33 @@ via the :meth:`pyramid.config.Configurator.add_route` method that will be
used when the URL is ``/``:
.. literalinclude:: src/basiclayout/tutorial/__init__.py
- :lines: 13-14
+ :lines: 13
:language: py
Since this route has a ``pattern`` equalling ``/`` it is the route that will
-be called when the URL ``/`` is visted, e.g. ``http://localhost:6543/``. The
-argument named ``view`` with the value ``tutorial.views.my_view`` is the
-dotted name to a *function* we write (generated by the
-``pyramid_routesalchemy`` scaffold) that is given a ``request`` object and
-which returns a response or a dictionary.
-
-You will use :meth:`pyramid.config.Configurator.add_route` statements in a
-:term:`URL dispatch` based application to map URLs to code. This route also
-names a ``view_renderer``, which is a template which lives in the
-``templates`` subdirectory of the package. When the
-``tutorial.views.my_view`` view returns a dictionary, a :term:`renderer` will
-use this template to create a response.
-
-Fimnally, we use the :meth:`pyramid.config.Configurator.make_wsgi_app`
+be called when the URL ``/`` is visted, e.g. ``http://localhost:6543/``.
+
+Mapping the ``home`` route to code is done by registering a ``view``. You will
+use :meth:`pyramid.config.Configurator.add_view` in :term:`URL dispatch` to
+register views for the routes, mapping your patterns to code:
+
+ .. literalinclude:: src/basiclayout/tutorial/__init__.py
+ :lines: 14
+ :language: py
+
+The ``view`` argument of ``tutorial.views.my_view`` is the dotted name to a
+*function* we write (generated by the ``pyramid_routesalchemy`` scaffold) that
+is given a ``request`` object and which returns a response or a dictionary.
+This view also names a ``renderer``, which is a template which lives in the
+``templates`` subdirectory of the package. When the ``tutorial.views.my_view``
+view returns a dictionary, a :term:`renderer` will use this template to create
+a response.
+
+Finally, we use the :meth:`pyramid.config.Configurator.make_wsgi_app`
method to return a :term:`WSGI` application:
.. literalinclude:: src/basiclayout/tutorial/__init__.py
- :lines: 15
+ :lines: 16
:language: py
Our final ``__init__.py`` file will look like this: