summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/narr/views.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/narr/views.rst b/docs/narr/views.rst
index c35027eb9..2f9bb7ff3 100644
--- a/docs/narr/views.rst
+++ b/docs/narr/views.rst
@@ -351,3 +351,22 @@ returned to the client.
See the :ref:`security_chapter` chapter to find out how to turn on
a security policy.
+Using a View to Do A HTTP Redirect
+----------------------------------
+
+You can issue an HTTP redirect from within a view by returning a
+slightly different response.
+
+.. code-block:: python
+ :linenos:
+
+ from webob.exc import HTTPFound
+
+ def myview(context, request):
+ return HTTPFound(location='http://example.com')
+
+All exception types from the :mod:`webob.exc` module implement the
+``IResponse`` 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 for Unauthorized, etc.
+