diff --git a/build/site/src/django-1.0.2-1.0.0FINAL/django/test/client.py b/build/site/src/django-1.0.2-1.0.0FINAL/django/test/client.py
index 282e668..03d8843 100644
|
a
|
b
|
|
| 1 | 1 | import urllib |
| 2 | 2 | import sys |
| 3 | 3 | import os |
| | 4 | import mimetypes |
| 4 | 5 | try: |
| 5 | 6 | from cStringIO import StringIO |
| 6 | 7 | except ImportError: |
| … |
… |
def encode_multipart(boundary, data):
|
| 127 | 128 | ]) |
| 128 | 129 | return '\r\n'.join(lines) |
| 129 | 130 | |
| | 131 | |
| 130 | 132 | def encode_file(boundary, key, file): |
| 131 | 133 | to_str = lambda s: smart_str(s, settings.DEFAULT_CHARSET) |
| 132 | 134 | return [ |
| 133 | 135 | '--' + boundary, |
| 134 | 136 | 'Content-Disposition: form-data; name="%s"; filename="%s"' \ |
| 135 | 137 | % (to_str(key), to_str(os.path.basename(file.name))), |
| 136 | | 'Content-Type: application/octet-stream', |
| | 138 | 'Content-Type: %s' % mimetypes.guess_type(file.name)[0] or 'application/octet-stream', |
| 137 | 139 | '', |
| 138 | 140 | file.read() |
| 139 | 141 | ] |
| 140 | 142 | |
| | 143 | |
| 141 | 144 | class Client(object): |
| 142 | 145 | """ |
| 143 | 146 | A class that can act as a client for testing purposes. |