summaryrefslogtreecommitdiff
path: root/docs/narr
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2010-10-25 23:09:02 -0400
committerChris McDonough <chrism@plope.com>2010-10-25 23:09:02 -0400
commit2e6905e15221691e645e5ff4ba0378a6d9438c29 (patch)
treeda97f7555bc11dc7369ad12beb1c04c91c713049 /docs/narr
parent0d1f2ff01465689a472b10bbded2fa4e7a895569 (diff)
downloadpyramid-2e6905e15221691e645e5ff4ba0378a6d9438c29.tar.gz
pyramid-2e6905e15221691e645e5ff4ba0378a6d9438c29.tar.bz2
pyramid-2e6905e15221691e645e5ff4ba0378a6d9438c29.zip
add httpexceptions docs
Diffstat (limited to 'docs/narr')
-rw-r--r--docs/narr/views.rst11
-rw-r--r--docs/narr/webob.rst27
2 files changed, 21 insertions, 17 deletions
diff --git a/docs/narr/views.rst b/docs/narr/views.rst
index f52df9557..2969487d3 100644
--- a/docs/narr/views.rst
+++ b/docs/narr/views.rst
@@ -298,16 +298,17 @@ particular kind of response.
.. code-block:: python
:linenos:
- from webob.exc import HTTPFound
+ from pyramid.httpexceptions import HTTPFound
def myview(request):
return HTTPFound(location='http://example.com')
All exception types from the :mod:`webob.exc` module implement the
-Webob :term:`Response` interface; any can be returned as the response
-from a view. See :term:`WebOb` for the documentation for this module;
-it includes other response types that imply other HTTP response codes,
-such as ``401 Unauthorized``.
+WebOb :term:`Response` interface; any can be returned as the response
+from a view. 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``.
.. index::
single: renderer
diff --git a/docs/narr/webob.rst b/docs/narr/webob.rst
index 82416a44d..b3bec882e 100644
--- a/docs/narr/webob.rst
+++ b/docs/narr/webob.rst
@@ -309,20 +309,23 @@ default to anything, though if you subclass ``Response`` and set
Exceptions
++++++++++
-To facilitate error responses like 404 Not Found, the module
-``webob.exc`` contains classes for each kind of error response. These
-include boring but appropriate error bodies.
-
-Each class is named ``webob.exc.HTTP*``, where ``*`` is the reason for
-the error. For instance, ``webob.exc.HTTPNotFound``. It subclasses
-``Response``, so you can manipulate the instances in the same way. A
-typical example is:
+To facilitate error responses like ``404 Not Found``, the module
+:mod:`webob.exc` contains classes for each kind of error response.
+These include boring but appropriate error bodies. The exceptions
+exposed by this module, when used under :mod:`pyramid`, should be
+imported from the :mod:`pyramid.httpexceptions` "facade" module.
+
+Each class is named ``pyramid.httpexceptions.HTTP*``, where ``*`` is
+the reason for the error. For instance,
+``pyramid.httpexceptions.HTTPNotFound``. It subclasses ``Response``,
+so you can manipulate the instances in the same way. A typical
+example is:
.. ignore-next-block
.. code-block:: python
- from webob.exc import HTTPNotFound
- from webob.exc import HTTPMovedPermanently
+ from pyramid.httpexceptions import HTTPNotFound
+ from pyramid.httpexceptions import HTTPMovedPermanently
response = HTTPNotFound('There is no such resource')
# or:
@@ -336,8 +339,8 @@ You can use this like:
.. code-block:: python
:linenos:
- from webob.exc import HTTPException
- from webob.exc import HTTPNotFound
+ from pyramid.httpexceptions import HTTPException
+ from pyramid.httpexceptions import HTTPNotFound
def aview(request):
try: