diff options
| author | Casey Duncan <casey.duncan@gmail.com> | 2010-11-28 01:00:13 -0700 |
|---|---|---|
| committer | Casey Duncan <casey.duncan@gmail.com> | 2010-11-28 01:00:13 -0700 |
| commit | 46353d75f7b9e3ed5aef70dc15e31fd192492a7a (patch) | |
| tree | b893915df67b56a05eacc3e856075b836ec56dd3 /docs | |
| parent | 4e1935984cdeb8df5f7295b1af1304aad6bde077 (diff) | |
| download | pyramid-46353d75f7b9e3ed5aef70dc15e31fd192492a7a.tar.gz pyramid-46353d75f7b9e3ed5aef70dc15e31fd192492a7a.tar.bz2 pyramid-46353d75f7b9e3ed5aef70dc15e31fd192492a7a.zip | |
Add note about httpexceptions not typically being raised
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/narr/views.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/narr/views.rst b/docs/narr/views.rst index 956ef20e9..4b2207640 100644 --- a/docs/narr/views.rst +++ b/docs/narr/views.rst @@ -302,6 +302,19 @@ See :mod:`pyramid.httpexceptions` for the documentation for the ``HTTPFound`` exception; it also includes other response types that imply other HTTP response codes, such as ``HTTPUnauthorized`` for ``401 Unauthorized``. +.. note:: + + Although exception types from the :mod:`pyramid.httpexceptions` module are + in fact bona fide Python :class:`Exception` types, the :app:`Pyramid` view + machinery expects them to be *returned* by a view callable rather than + *raised*. + + It is possible, however, in Python 2.5 and above, to configure an + *exception view* to catch these exceptions, and return an appropriate + :class:`pyramid.response.Response`. The simplest such view could just + catch and return the original exception. See :ref:`exception_views` for + more details. + .. index:: single: renderer single: view renderer |
