summaryrefslogtreecommitdiff
path: root/docs/tutorials
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-04-22 13:42:19 -0400
committerChris McDonough <chrism@plope.com>2011-04-22 13:42:19 -0400
commited7ffe0e2065100f551793b3774656d8bdde0fb0 (patch)
tree53637b76d148774c5a7c3b9e103373e33e6c2f9e /docs/tutorials
parentc150d77248653172b487326a1059b8c0bc5056e4 (diff)
downloadpyramid-ed7ffe0e2065100f551793b3774656d8bdde0fb0.tar.gz
pyramid-ed7ffe0e2065100f551793b3774656d8bdde0fb0.tar.bz2
pyramid-ed7ffe0e2065100f551793b3774656d8bdde0fb0.zip
- Make sure deprecation warnings aren't raised when tests are run.
- Modify documentation for cross-referencing. - Use add_view(viewname) syntax rather than add_view(view=viewname) syntax for normalization. - Use warnings.warn rather than zope.deprecated in order to make testing easier. - Move tests which test deprecated methods of configurator to a separate test case.
Diffstat (limited to 'docs/tutorials')
-rw-r--r--docs/tutorials/wiki2/basiclayout.rst19
-rw-r--r--docs/tutorials/wiki2/definingviews.rst6
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/__init__.py10
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/__init__.py2
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/__init__.py2
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/__init__.py8
6 files changed, 24 insertions, 23 deletions
diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst
index bb39a686d..82e112c64 100644
--- a/docs/tutorials/wiki2/basiclayout.rst
+++ b/docs/tutorials/wiki2/basiclayout.rst
@@ -85,9 +85,9 @@ used when the URL is ``/``:
: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/``.
+be matched when the URL ``/`` is visted, e.g. ``http://localhost:6543/``.
-Mapping the ``home`` route to code is done by registering a ``view``. You will
+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:
@@ -95,13 +95,14 @@ register views for the routes, mapping your patterns to code:
: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.
+The first positional ``add_view`` argument ``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. This
Finally, we use the :meth:`pyramid.config.Configurator.make_wsgi_app`
method to return a :term:`WSGI` application:
diff --git a/docs/tutorials/wiki2/definingviews.rst b/docs/tutorials/wiki2/definingviews.rst
index f59f75702..832f90b92 100644
--- a/docs/tutorials/wiki2/definingviews.rst
+++ b/docs/tutorials/wiki2/definingviews.rst
@@ -282,8 +282,7 @@ these declarations is very important. ``route`` declarations are matched in
the order they're found in the ``__init__.py`` file.
#. Add a declaration which maps the pattern ``/`` (signifying the root URL)
- to the route named ``view_wiki``. This is the :term:`default view` for the
- wiki.
+ to the route named ``view_wiki``.
#. Add a declaration which maps the pattern ``/{pagename}`` to the route named
``view_page``. This is the regular view for a page.
@@ -299,7 +298,8 @@ to handle the processing and rendering that needs to happen when each route is
requested.
#. Add a declaration which maps the ``view_wiki`` route to the view named
- ``view_wiki`` in our ``views.py`` file.
+ ``view_wiki`` in our ``views.py`` file. This is the :term:`default view`
+ for the wiki.
#. Add a declaration which maps the ``view_page`` route to the view named
``view_page`` in our ``views.py`` file.
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py b/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py
index 7da99775c..e8baa568c 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py
@@ -29,14 +29,14 @@ def main(global_config, **settings):
config.add_route('edit_page', '/{pagename}/edit_page')
config.add_route('view_wiki', '/')
- config.add_view(route_name='login', view='tutorial.login.login',
+ config.add_view('tutorial.login.login', route_name='login',
renderer='tutorial:templates/login.pt')
- config.add_view(route_name='logout', view='tutorial.login.logout')
- config.add_view(route_name='view_page', view='tutorial.views.view_page',
+ config.add_view('tutorial.login.logout', route_name='logout')
+ config.add_view('tutorial.views.view_page', route_name='view_page',
renderer='tutorial:templates/view.pt')
- config.add_view(route_name='add_page', view='tutorial.views.add_page',
+ config.add_view('tutorial.views.add_page', route_name='add_page',
renderer='tutorial:templates/edit.pt', permission='edit')
- config.add_view(route_name='edit_page', view='tutorial.views.edit_page',
+ config.add_view('tutorial.views.edit_page', route_name='edit_page',
renderer='tutorial:templates/edit.pt', permission='edit')
config.add_view('tutorial.login.login',
context='pyramid.exceptions.Forbidden',
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/__init__.py b/docs/tutorials/wiki2/src/basiclayout/tutorial/__init__.py
index 43fd7f0fe..c74f07652 100644
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/__init__.py
+++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/__init__.py
@@ -11,7 +11,7 @@ def main(global_config, **settings):
config = Configurator(settings=settings)
config.add_static_view('static', 'tutorial:static')
config.add_route('home', '/')
- config.add_view(route_name='home', view='tutorial.views.my_view',
+ config.add_view('tutorial.views.my_view', route_name='home',
renderer='templates/mytemplate.pt')
return config.make_wsgi_app()
diff --git a/docs/tutorials/wiki2/src/models/tutorial/__init__.py b/docs/tutorials/wiki2/src/models/tutorial/__init__.py
index ff46bbf8f..ecc41ca9f 100644
--- a/docs/tutorials/wiki2/src/models/tutorial/__init__.py
+++ b/docs/tutorials/wiki2/src/models/tutorial/__init__.py
@@ -11,6 +11,6 @@ def main(global_config, **settings):
config = Configurator(settings=settings)
config.add_static_view('static', 'tutorial:static')
config.add_route('home', '/')
- config.add_view(route_name='home', view='tutorial.views.my_view',
+ config.add_view('tutorial.views.my_view', route_name='home',
renderer='templates/mytemplate.pt')
return config.make_wsgi_app()
diff --git a/docs/tutorials/wiki2/src/views/tutorial/__init__.py b/docs/tutorials/wiki2/src/views/tutorial/__init__.py
index 93abf83e7..ad89c124e 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/__init__.py
+++ b/docs/tutorials/wiki2/src/views/tutorial/__init__.py
@@ -14,12 +14,12 @@ def main(global_config, **settings):
config.add_route('view_page', '/{pagename}')
config.add_route('add_page', '/add_page/{pagename}')
config.add_route('edit_page', '/{pagename}/edit_page')
- config.add_view(route_name='view_wiki', view='tutorial.views.view_wiki')
- config.add_view(route_name='view_page', view='tutorial.views.view_page',
+ config.add_view('tutorial.views.view_wiki', route_name='view_wiki')
+ config.add_view('tutorial.views.view_page', route_name='view_page',
renderer='tutorial:templates/view.pt')
- config.add_view(route_name='add_page', view='tutorial.views.add_page',
+ config.add_view('tutorial.views.add_page', route_name='add_page',
renderer='tutorial:templates/edit.pt')
- config.add_view(route_name='edit_page', view='tutorial.views.edit_page',
+ config.add_view('tutorial.views.edit_page', route_name='edit_page',
renderer='tutorial:templates/edit.pt')
return config.make_wsgi_app()