Ticket #13876: 13876.2.diff

File 13876.2.diff, 1.6 KB (added by Tim Graham, 14 years ago)

more concise wording, correct position of versionadded tag

  • docs/ref/request-response.txt

     
    4646    attr:`~HttpRequest.path` can make your code much easier to move between test
    4747    and deployment servers.
    4848
    49     For example, if the ``django.root`` for your application is set to 
     49    For example, if the ``django.root`` for your application is set to
    5050    ``"/minfo"``, then ``path`` might be ``"/minfo/music/bands/the_beatles/"``
    5151    and ``path_info`` would be ``"/music/bands/the_beatles/"``.
    5252
     
    420420    >>> response.write("<p>Here's the text of the Web page.</p>")
    421421    >>> response.write("<p>Here's another paragraph.</p>")
    422422
    423 You can add and delete headers using dictionary syntax::
    424 
    425     >>> response = HttpResponse()
    426     >>> response['X-DJANGO'] = "It's the best."
    427     >>> del response['X-PHP']
    428     >>> response['X-DJANGO']
    429     "It's the best."
    430 
    431 Note that ``del`` doesn't raise ``KeyError`` if the header doesn't exist.
    432 
    433423Passing iterators
    434424~~~~~~~~~~~~~~~~~
    435425
     
    444434Setting headers
    445435~~~~~~~~~~~~~~~
    446436
    447 To set a header in your response, just treat it like a dictionary::
     437To set or remove a header in your response, treat it like a dictionary::
    448438
    449439    >>> response = HttpResponse()
    450440    >>> response['Cache-Control'] = 'no-cache'
     441    >>> del response['Cache-Control']
    451442
     443Note that unlike a dictionary, ``del`` doesn't raise ``KeyError`` if the header
     444doesn't exist.
     445
    452446.. versionadded:: 1.1
    453447
    454448HTTP headers cannot contain newlines. An attempt to set a header containing a
Back to Top