summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2010-10-01 02:39:25 +0000
committerJannis Leidel <jannis@leidel.info>2010-10-01 02:39:25 +0000
commitebc084ca351a8d79a26f5239afc1b46a4d245139 (patch)
tree43f146108294ca37d6fba8a3617f594a7f775e8b /docs
parent89e0fde94834da40f9083698227500d1ea0ec2cf (diff)
[1.2.X] Fixed #13876 -- Fixed duplication in docs. Thanks, zerok and timo.
Backport from trunk (r13966). git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13972 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/request-response.txt16
1 files changed, 5 insertions, 11 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index bf984f4fa8..a944abeddc 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -405,16 +405,6 @@ file-like object::
>>> response.write("<p>Here's the text of the Web page.</p>")
>>> response.write("<p>Here's another paragraph.</p>")
-You can add and delete headers using dictionary syntax::
-
- >>> response = HttpResponse()
- >>> response['X-DJANGO'] = "It's the best."
- >>> del response['X-PHP']
- >>> response['X-DJANGO']
- "It's the best."
-
-Note that ``del`` doesn't raise ``KeyError`` if the header doesn't exist.
-
Passing iterators
~~~~~~~~~~~~~~~~~
@@ -429,10 +419,14 @@ hard-coded strings. If you use this technique, follow these guidelines:
Setting headers
~~~~~~~~~~~~~~~
-To set a header in your response, just treat it like a dictionary::
+To set or remove a header in your response, treat it like a dictionary::
>>> response = HttpResponse()
>>> response['Cache-Control'] = 'no-cache'
+ >>> del response['Cache-Control']
+
+Note that unlike a dictionary, ``del`` doesn't raise ``KeyError`` if the header
+doesn't exist.
.. versionadded:: 1.1