summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-05-31 03:13:13 +0000
committerChris McDonough <chrism@agendaless.com>2009-05-31 03:13:13 +0000
commit4936f862588240c51e619a65aa5d574ba29d784b (patch)
treef73f81fa6f2603773948598218d32d74c6475ee2 /docs
parent964b7852d997f6c4aa4b04d54f2847095e4461e8 (diff)
downloadpyramid-4936f862588240c51e619a65aa5d574ba29d784b.tar.gz
pyramid-4936f862588240c51e619a65aa5d574ba29d784b.tar.bz2
pyramid-4936f862588240c51e619a65aa5d574ba29d784b.zip
Features
-------- - It is now possible to register a custom ``repoze.bfg.interfaces.INotFoundView`` for a given application. This feature replaces the ``repoze.bfg.interfaces.INotFoundAppFactory`` feature previously described in the Hooks chapter. The INotFoundView will be called when the framework detects that a view lookup done as a result of a reqest fails; it should accept a context object and a request object; it should return an IResponse object (a webob response, basically). See the Hooks narrative chapter of the BFG docs for more info. Deprecations ------------ - The ``repoze.bfg.interfaces.IUnauthorizedAppFactory`` interface has been deprecated in favor of using the new ``repoze.bfg.interfaces.IForbiddenResponseFactory`` mechanism.
Diffstat (limited to 'docs')
-rw-r--r--docs/narr/hooks.rst42
1 files changed, 19 insertions, 23 deletions
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index bc00b28a7..ace2c847b 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -88,41 +88,37 @@ an object that implements any particular interface; it simply needs
have a ``status`` attribute, a ``headerlist`` attribute, and and
``app_iter`` attribute.
-Changing the NotFound Application
----------------------------------
+Changing the Not Found View
+---------------------------
-When :mod:`repoze.bfg` can't map a URL to code, it creates and invokes
-a NotFound WSGI application. The application it invokes can be
-customized by placing something like the following ZCML in your
-``configure.zcml`` file.
+When :mod:`repoze.bfg` can't map a URL to view code, it invokes a
+notfound :term:`view`. The view it invokes can be customized by
+placing something like the following ZCML in your ``configure.zcml``
+file.
.. code-block:: xml
:linenos:
- <utility provides="repoze.bfg.interfaces.INotFoundAppFactory"
- component="helloworld.factories.notfound_app_factory"/>
+ <utility provides="repoze.bfg.interfaces.INotFoundView"
+ component="helloworld.views.notfound_view"/>
-Replace ``helloworld.factories.notfound_app_factory`` with the Python
-dotted name to the request factory you want to use. Here's some
-sample code that implements a minimal NotFound application factory:
+Replace ``helloworld.views.notfound_view`` with the Python dotted name
+to the notfound view you want to use. Here's some sample code that
+implements a minimal NotFound view:
.. code-block:: python
from webob.exc import HTTPNotFound
- class MyNotFound(HTTPNotFound):
- pass
+ def notfound_view(context, request):
+ return HTTPNotFound()
- def notfound_app_factory():
- return MyNotFound
-
-.. note:: When a NotFound application factory is invoked, it is passed
- the WSGI environ and the WSGI ``start_response`` handler by
- :mod:`repoze.bfg`. Within the WSGI environ will be a key named
- ``repoze.bfg.message`` that has a value explaining why the not
- found error was raised. This error will be different when the
- ``debug_notfound`` environment setting is true than it is when it
- is false.
+.. note:: When a NotFound view is invoked, it is passed a request.
+ The ``environ`` attribute of the request is the WSGI environment.
+ Within the WSGI environ will be a key named ``repoze.bfg.message``
+ that has a value explaining why the not found error was raised.
+ This error will be different when the ``debug_notfound``
+ environment setting is true than it is when it is false.
Changing the Forbidden View
---------------------------