diff options
| author | Jannis Leidel <jannis@leidel.info> | 2010-10-01 02:01:38 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2010-10-01 02:01:38 +0000 |
| commit | 8e301812fa6349b410db44fd4d6fe1df388635c3 (patch) | |
| tree | d86e9b1b6902bbf97a3b37e8b90e0607775b72db /docs/ref | |
| parent | d69c7eab041d30c1cf8a4ee8d6426d47e90254b1 (diff) | |
Fixed #13876 -- Fixed duplication in docs. Thanks, zerok and timo.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13966 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/request-response.txt | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 064f1201f7..380210d064 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -420,16 +420,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 ~~~~~~~~~~~~~~~~~ @@ -444,10 +434,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 |
