From 267f2db66f514db43d0801237213799cd6797ee4 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 25 May 2009 00:27:08 +0000 Subject: Change the semantics of IForbiddenAppFactory. --- docs/narr/hooks.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'docs') diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index 5eab5e41e..aefa95046 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -145,13 +145,10 @@ factory: .. code-block:: python - from webob.exc import HTTPForbidden + from repoze.bfg.chameleon_zpt import render_template_to_response - class MyForbidden(HTTPForbidden): - pass - - def forbidden_app_factory(): - return MyForbidden + def forbidden_app_factory(context, request): + return render_template_to_response('templates/login_form.pt') .. note:: When an Forbidden application factory is invoked, it is passed the WSGI environ and the WSGI ``start_response`` handler by @@ -159,7 +156,8 @@ factory: ``repoze.bfg.message`` that has a value explaining why the action was forbidden. This error will be different when the ``debug_authorization`` environment setting is true than it is when - it is false. + it is false. A WebOb ``Response`` object is a valid WSGI + application, by the way. .. warning:: the default forbidden application factory sends a response with a ``401 Unauthorized`` status code for backwards -- cgit v1.2.3