summaryrefslogtreecommitdiff
path: root/docs/narr/views.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-06-20 00:57:30 -0400
committerChris McDonough <chrism@plope.com>2011-06-20 00:57:30 -0400
commitf8f08bac0ea9edcac40fae2b3ad56e6a1ac7f47f (patch)
tree3afd4c622f2dad1248fe20a35928a2c58e99af17 /docs/narr/views.rst
parentd69ae60b9a195c7cb72122b59335ba886bfffe50 (diff)
downloadpyramid-f8f08bac0ea9edcac40fae2b3ad56e6a1ac7f47f.tar.gz
pyramid-f8f08bac0ea9edcac40fae2b3ad56e6a1ac7f47f.tar.bz2
pyramid-f8f08bac0ea9edcac40fae2b3ad56e6a1ac7f47f.zip
responsecode -> exception_response
Diffstat (limited to 'docs/narr/views.rst')
-rw-r--r--docs/narr/views.rst19
1 files changed, 11 insertions, 8 deletions
diff --git a/docs/narr/views.rst b/docs/narr/views.rst
index e3d0a37e5..cbd8fcfb7 100644
--- a/docs/narr/views.rst
+++ b/docs/narr/views.rst
@@ -300,27 +300,30 @@ An HTTP exception, instead of being raised, can alternately be *returned*
return HTTPUnauthorized()
A shortcut for creating an HTTP exception is the
-:func:`pyramid.httpexceptions.responsecode` function. This function accepts
-an HTTP status code and returns the corresponding HTTP exception. For
-example, instead of importing and constructing a
+:func:`pyramid.httpexceptions.exception_response` function. This function
+accepts an HTTP status code and returns the corresponding HTTP exception.
+For example, instead of importing and constructing a
:class:`~pyramid.httpexceptions.HTTPUnauthorized` response object, you can
-use the :func:`~pyramid.httpexceptions.responsecode` function to construct
-and return the same object.
+use the :func:`~pyramid.httpexceptions.exception_response` function to
+construct and return the same object.
.. code-block:: python
:linenos:
- from pyramid.httpexceptions import responsecode
+ from pyramid.httpexceptions import exception_response
def aview(request):
- raise responsecode(401)
+ raise exception_response(401)
This is the case because ``401`` is the HTTP status code for "HTTP
-Unauthorized". Therefore, ``raise responsecode(401)`` is functionally
+Unauthorized". Therefore, ``raise exception_response(401)`` is functionally
equivalent to ``raise HTTPUnauthorized()``. Documentation which maps each
HTTP response code to its purpose and its associated HTTP exception object is
provided within :mod:`pyramid.httpexceptions`.
+.. note:: The :func:`~pyramid.httpexceptions.exception_response` function is
+ new as of Pyramid 1.1.
+
How Pyramid Uses HTTP Exceptions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~