Author: russellm
Date: 2010-05-09 01:42:16 -0500 (Sun, 09 May 2010)
New Revision: 13166
Modified:
django/trunk/docs/topics/testing.txt
Log:
Fixed #12412 -- Clarified the documentation around file handling by the test
client. Thanks to Gabriel Hurley for the draft patch.
Modified: django/trunk/docs/topics/testing.txt
===================================================================
--- django/trunk/docs/topics/testing.txt 2010-05-09 05:52:38 UTC (rev
13165)
+++ django/trunk/docs/topics/testing.txt 2010-05-09 06:42:16 UTC (rev
13166)
@@ -668,9 +668,17 @@
(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`.
.. versionchanged:: 1.1
--
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.