diff options
| author | Chris McDonough <chrism@plope.com> | 2011-06-20 00:57:30 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-06-20 00:57:30 -0400 |
| commit | f8f08bac0ea9edcac40fae2b3ad56e6a1ac7f47f (patch) | |
| tree | 3afd4c622f2dad1248fe20a35928a2c58e99af17 /docs | |
| parent | d69ae60b9a195c7cb72122b59335ba886bfffe50 (diff) | |
| download | pyramid-f8f08bac0ea9edcac40fae2b3ad56e6a1ac7f47f.tar.gz pyramid-f8f08bac0ea9edcac40fae2b3ad56e6a1ac7f47f.tar.bz2 pyramid-f8f08bac0ea9edcac40fae2b3ad56e6a1ac7f47f.zip | |
responsecode -> exception_response
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api/httpexceptions.rst | 2 | ||||
| -rw-r--r-- | docs/narr/views.rst | 19 | ||||
| -rw-r--r-- | docs/whatsnew-1.1.rst | 13 |
3 files changed, 18 insertions, 16 deletions
diff --git a/docs/api/httpexceptions.rst b/docs/api/httpexceptions.rst index 325d5af03..89be17a2d 100644 --- a/docs/api/httpexceptions.rst +++ b/docs/api/httpexceptions.rst @@ -11,7 +11,7 @@ integer "401" maps to :class:`pyramid.httpexceptions.HTTPUnauthorized`). - .. autofunction:: responsecode + .. autofunction:: exception_response .. autoclass:: HTTPException 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 172a20343..cee701b49 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -18,8 +18,7 @@ The major feature additions in Pyramid 1.1 are: - Support for "static" routes. -- Default HTTP exception view and associated ``redirect`` and ``abort`` - convenience functions. +- Default HTTP exception view. ``request.response`` ~~~~~~~~~~~~~~~~~~~~ @@ -56,8 +55,8 @@ Static Routes Default HTTP Exception View ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- A default exception view for the context :exc:`webob.exc.HTTPException` - (aka :class:`pyramid.httpexceptions.HTTPException`) is now registered by +- A default exception view for the context + :class:`pyramid.interfaces.IExceptionResponse` is now registered by default. This means that an instance of any exception class imported from :mod:`pyramid.httpexceptions` (such as ``HTTPFound``) can now be raised from within view code; when raised, this exception view will render the @@ -79,9 +78,9 @@ Minor Feature Additions :class:`pyramid.authentication.SessionAuthenticationPolicy`, which uses a session to store credentials. -- A function named :func:`pyramid.httpexceptions.responsecode` is a shortcut - that can be used to create HTTP exception response objects using an HTTP - integer status code. +- A function named :func:`pyramid.httpexceptions.exception_response` is a + shortcut that can be used to create HTTP exception response objects using + an HTTP integer status code. - Integers and longs passed as ``elements`` to :func:`pyramid.url.resource_url` or |
