diff options
| author | Chris McDonough <chrism@plope.com> | 2011-04-22 10:21:30 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-04-22 10:21:30 -0400 |
| commit | c150d77248653172b487326a1059b8c0bc5056e4 (patch) | |
| tree | 48b508a5e7047bc8d9ff77defaf82af87bdb2ec8 /docs/tutorials/wiki2/basiclayout.rst | |
| parent | feef5257261f3c37f11571a475dbd68f603b144e (diff) | |
| parent | 1612fe799b5d36d3c7c39468be55b15777730f62 (diff) | |
| download | pyramid-c150d77248653172b487326a1059b8c0bc5056e4.tar.gz pyramid-c150d77248653172b487326a1059b8c0bc5056e4.tar.bz2 pyramid-c150d77248653172b487326a1059b8c0bc5056e4.zip | |
Merge branch 'disambiguate_add_route' of https://github.com/mmerickel/pyramid into mmerickel-disambiguate_add_route
Diffstat (limited to 'docs/tutorials/wiki2/basiclayout.rst')
| -rw-r--r-- | docs/tutorials/wiki2/basiclayout.rst | 37 |
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: |
