diff options
| author | Chris McDonough <chrism@plope.com> | 2012-02-22 19:24:09 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2012-02-22 19:24:09 -0500 |
| commit | a7fe30f0eabd6c6fd3bcc910faa41720a75056de (patch) | |
| tree | 6a34903cffb35eac455614b9fd6d1700e24d58b1 /docs/tutorials/wiki/src/tests | |
| parent | 2d045891789c58856831dc676d06c0b86fdd84c5 (diff) | |
| download | pyramid-a7fe30f0eabd6c6fd3bcc910faa41720a75056de.tar.gz pyramid-a7fe30f0eabd6c6fd3bcc910faa41720a75056de.tar.bz2 pyramid-a7fe30f0eabd6c6fd3bcc910faa41720a75056de.zip | |
- New API: ``pyramid.config.Configurator.add_forbidden_view``. This is a
wrapper for ``pyramid.Config.configurator.add_view`` which does the right
thing about permissions. It should be preferred over calling ``add_view``
directly with ``context=HTTPForbidden`` as was previously recommended.
- New API: ``pyramid.view.forbidden_view_config``. This is a decorator
constructor like ``pyramid.view.view_config`` that calls
``pyramid.config.Configurator.add_forbidden_view`` when scanned. It should
be preferred over using ``pyramid.view.view_config`` with
``context=HTTPForbidden`` as was previously recommended.
- Updated the "Creating a Not Forbidden View" section of the "Hooks" chapter,
replacing explanations of registering a view using ``add_view`` or
``view_config`` with ones using ``add_forbidden_view`` or
``forbidden_view_config``.
- Updated all tutorials to use ``pyramid.view.forbidden_view_config`` rather
than ``pyramid.view.view_config`` with an HTTPForbidden context.
Diffstat (limited to 'docs/tutorials/wiki/src/tests')
| -rw-r--r-- | docs/tutorials/wiki/src/tests/tutorial/views.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/tutorials/wiki/src/tests/tutorial/views.py b/docs/tutorials/wiki/src/tests/tutorial/views.py index 2f0502c17..fcbe6fe25 100644 --- a/docs/tutorials/wiki/src/tests/tutorial/views.py +++ b/docs/tutorials/wiki/src/tests/tutorial/views.py @@ -3,7 +3,10 @@ import re from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config +from pyramid.view import ( + view_config, + forbidden_view_config, + ) from pyramid.security import ( authenticated_userid, @@ -82,8 +85,7 @@ def edit_page(context, request): @view_config(context='.models.Wiki', name='login', renderer='templates/login.pt') -@view_config(context='pyramid.httpexceptions.HTTPForbidden', - renderer='templates/login.pt') +@forbidden_view_config(renderer='templates/login.pt') def login(request): login_url = request.resource_url(request.context, 'login') referrer = request.url |
