diff options
| author | 薛丞宏 <ihcaoe@gmail.com> | 2015-10-23 21:12:49 +0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-10-23 14:27:20 -0400 |
| commit | 2eab4acb3e523d296b3ed1e0374d2a40486e96cc (patch) | |
| tree | 90f829950651461c6265f561e0d71d3cbf7bdfe9 /docs | |
| parent | ca46dc323b67ac90d0e8c8290b2bcb6d100c5118 (diff) | |
[1.9.x] Clarified that the test client response content attribute is bytes.
Backport of 484edc81c1ebd195c333f3ea8d3f9ca882a17837 from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/intro/tutorial05.txt | 4 | ||||
| -rw-r--r-- | docs/ref/request-response.txt | 2 | ||||
| -rw-r--r-- | docs/topics/testing/tools.txt | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/docs/intro/tutorial05.txt b/docs/intro/tutorial05.txt index fe108d3db9..09c4ff2a96 100644 --- a/docs/intro/tutorial05.txt +++ b/docs/intro/tutorial05.txt @@ -367,7 +367,7 @@ With that ready, we can ask the client to do some work for us:: >>> response.status_code 200 >>> response.content - '\n\n\n <p>No polls are available.</p>\n\n' + b'\n\n\n <p>No polls are available.</p>\n\n' >>> # note - you might get unexpected results if your ``TIME_ZONE`` >>> # in ``settings.py`` is not correct. If you need to change it, >>> # you will also need to restart your shell session @@ -379,7 +379,7 @@ With that ready, we can ask the client to do some work for us:: >>> # check the response once again >>> response = client.get('/polls/') >>> response.content - '\n\n\n <ul>\n \n <li><a href="/polls/1/">Who is your favorite Beatle?</a></li>\n \n </ul>\n\n' + b'\n\n\n <ul>\n \n <li><a href="/polls/1/">Who is your favorite Beatle?</a></li>\n \n </ul>\n\n' >>> # If the following doesn't work, you probably omitted the call to >>> # setup_test_environment() described above >>> response.context['latest_question_list'] diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 76a624d984..1b0199fbbb 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -949,7 +949,7 @@ Typical usage could look like:: >>> from django.http import JsonResponse >>> response = JsonResponse({'foo': 'bar'}) >>> response.content - '{"foo": "bar"}' + b'{"foo": "bar"}' Serializing non-dictionary objects diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt index 6a394bb148..107fb6095c 100644 --- a/docs/topics/testing/tools.txt +++ b/docs/topics/testing/tools.txt @@ -54,7 +54,7 @@ Web pages:: 200 >>> response = c.get('/customer/details/') >>> response.content - '<!DOCTYPE html...' + b'<!DOCTYPE html...' As this example suggests, you can instantiate ``Client`` from within a session of the Python interactive interpreter. @@ -439,8 +439,8 @@ Specifically, a ``Response`` object has the following attributes: .. attribute:: content - The body of the response, as a string. This is the final page content as - rendered by the view, or any error message. + The body of the response, as a bytestring. This is the final page + content as rendered by the view, or any error message. .. attribute:: context |
