diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-01-17 18:26:09 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-01-17 18:26:09 +0000 |
| commit | b861a5ebaa6adae3ab102cb5656a1ae9b9f115e8 (patch) | |
| tree | 4f75a5a86ab18e230f0fd0327785326116c05cf2 | |
| parent | 38b33d485322759050510c96a75334e36ca63c30 (diff) | |
| download | pyramid-b861a5ebaa6adae3ab102cb5656a1ae9b9f115e8.tar.gz pyramid-b861a5ebaa6adae3ab102cb5656a1ae9b9f115e8.tar.bz2 pyramid-b861a5ebaa6adae3ab102cb5656a1ae9b9f115e8.zip | |
Checklist.
| -rw-r--r-- | TODO.txt | 2 | ||||
| -rw-r--r-- | docs/narr/views.rst | 14 |
2 files changed, 14 insertions, 2 deletions
@@ -15,8 +15,6 @@ - Add an example of URL match ordering when routes compete to the urldispatch chapter. -- Add an example of varying the attributes of a renderered response (7.1.8). - - Review tutorials. - Review index. diff --git a/docs/narr/views.rst b/docs/narr/views.rst index 3454299a1..9af12dd4e 100644 --- a/docs/narr/views.rst +++ b/docs/narr/views.rst @@ -557,6 +557,20 @@ callable to influence associated response attributes. achieved by returning various values in the ``response_headerlist``, this is purely a convenience. +For example, if you need to change the response status from within a +view callable that uses a renderer, assign the ``response_status`` +attribute to the request before returning a result: + +.. code-block:: python + :linenos: + + from repoze.bfg.view import bfg_view + + @bfg_view(name='gone') + def myview(request): + request.response_status = '404 Not Found' + return {'URL':request.URL} + .. index:: pair: renderers; adding |
