diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-05-09 06:42:16 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-05-09 06:42:16 +0000 |
| commit | bae2fa6f5cfd6827c0bdd995fe72dbb6794b7f9d (patch) | |
| tree | 19c01c5ea6fb7d12431c255a619332ad40e09059 /docs | |
| parent | 5a74f0c936b2b1ff3764ad7a3f9019e0d8e9a4eb (diff) | |
Fixed #12412 -- Clarified the documentation around file handling by the test client. Thanks to Gabriel Hurley for the draft patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13166 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/testing.txt | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt index fc5323c3cd..bd727ee136 100644 --- a/docs/topics/testing.txt +++ b/docs/topics/testing.txt @@ -668,8 +668,16 @@ arguments at time of construction: (The name ``attachment`` here is not relevant; use whatever name your file-processing code expects.) - Note that you should manually close the file after it has been provided - to ``post()``. + Note that if you wish to use the same file handle for multiple + ``post()`` calls then you will need to manually reset the file + pointer between posts. The easiest way to do this is to + manually close the file after it has been provided to + ``post()``, as demonstrated above. + + You should also ensure that the file is opened in a way that + allows the data to be read. If your file contains binary data + such as an image, this means you will need to open the file in + ``rb`` (read binary) mode. The ``extra`` argument acts the same as for :meth:`Client.get`. |
