summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2008-11-14 15:29:25 +0000
committerChris McDonough <chrism@agendaless.com>2008-11-14 15:29:25 +0000
commitcdf3212a3b56c46653e68bb092af656a20c9224f (patch)
tree9a81d1cd9e9590589bde2f3d1356903b9aae8610 /docs
parent5f6898f5abf11d51052357d3e725298f49d10cdc (diff)
downloadpyramid-cdf3212a3b56c46653e68bb092af656a20c9224f.tar.gz
pyramid-cdf3212a3b56c46653e68bb092af656a20c9224f.tar.bz2
pyramid-cdf3212a3b56c46653e68bb092af656a20c9224f.zip
Describe doing an HTTP redirect.
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.
+