Author: jezdez
Date: 2010-09-30 21:01:38 -0500 (Thu, 30 Sep 2010)
New Revision: 13966
Modified:
django/trunk/docs/ref/request-response.txt
Log:
Fixed #13876 -- Fixed duplication in docs. Thanks, zerok and timo.
Modified: django/trunk/docs/ref/request-response.txt
===================================================================
--- django/trunk/docs/ref/request-response.txt 2010-10-01 02:01:20 UTC (rev
13965)
+++ django/trunk/docs/ref/request-response.txt 2010-10-01 02:01:38 UTC (rev
13966)
@@ -420,16 +420,6 @@
>>> 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
~~~~~~~~~~~~~~~~~
@@ -444,11 +434,15 @@
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
HTTP headers cannot contain newlines. An attempt to set a header containing a
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.