# HG changeset patch
# User Andrew Godwin <andrew@aeracode.org>
# Date 1293036814 0
# Branch ticket-14939
# Node ID bac56f6f4aa0c4f9996f298218be09e1b0f6fe2d
# Parent 35aeedea954d3291644a7377933443f50cdba77c
Initial patch, without tests
diff -r 35aeedea954d -r bac56f6f4aa0 django/test/client.py
a
|
b
|
|
203 | 203 | "Construct a generic request object." |
204 | 204 | return WSGIRequest(self._base_environ(**request)) |
205 | 205 | |
| 206 | def _get_path(self, parsed): |
| 207 | # If there are parameters, add them |
| 208 | if parsed[3]: |
| 209 | return urllib.unquote(parsed[2] + ";" + parsed[3]) |
| 210 | else: |
| 211 | return urllib.unquote(parsed[2]) |
| 212 | |
206 | 213 | def get(self, path, data={}, **extra): |
207 | 214 | "Construct a GET request" |
208 | 215 | |
209 | 216 | parsed = urlparse(path) |
210 | 217 | r = { |
211 | 218 | 'CONTENT_TYPE': 'text/html; charset=utf-8', |
212 | | 'PATH_INFO': urllib.unquote(parsed[2]), |
| 219 | 'PATH_INFO': self._get_path(parsed), |
213 | 220 | 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], |
214 | 221 | 'REQUEST_METHOD': 'GET', |
215 | 222 | 'wsgi.input': FakePayload('') |
… |
… |
|
236 | 243 | r = { |
237 | 244 | 'CONTENT_LENGTH': len(post_data), |
238 | 245 | 'CONTENT_TYPE': content_type, |
239 | | 'PATH_INFO': urllib.unquote(parsed[2]), |
| 246 | 'PATH_INFO': self._get_path(parsed), |
240 | 247 | 'QUERY_STRING': parsed[4], |
241 | 248 | 'REQUEST_METHOD': 'POST', |
242 | 249 | 'wsgi.input': FakePayload(post_data), |
… |
… |
|
250 | 257 | parsed = urlparse(path) |
251 | 258 | r = { |
252 | 259 | 'CONTENT_TYPE': 'text/html; charset=utf-8', |
253 | | 'PATH_INFO': urllib.unquote(parsed[2]), |
| 260 | 'PATH_INFO': self._get_path(parsed), |
254 | 261 | 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], |
255 | 262 | 'REQUEST_METHOD': 'HEAD', |
256 | 263 | 'wsgi.input': FakePayload('') |
… |
… |
|
263 | 270 | |
264 | 271 | parsed = urlparse(path) |
265 | 272 | r = { |
266 | | 'PATH_INFO': urllib.unquote(parsed[2]), |
| 273 | 'PATH_INFO': self._get_path(parsed), |
267 | 274 | 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], |
268 | 275 | 'REQUEST_METHOD': 'OPTIONS', |
269 | 276 | 'wsgi.input': FakePayload('') |
… |
… |
|
290 | 297 | r = { |
291 | 298 | 'CONTENT_LENGTH': len(post_data), |
292 | 299 | 'CONTENT_TYPE': content_type, |
293 | | 'PATH_INFO': urllib.unquote(parsed[2]), |
| 300 | 'PATH_INFO': self._get_path(parsed), |
294 | 301 | 'QUERY_STRING': query_string or parsed[4], |
295 | 302 | 'REQUEST_METHOD': 'PUT', |
296 | 303 | 'wsgi.input': FakePayload(post_data), |
… |
… |
|
303 | 310 | |
304 | 311 | parsed = urlparse(path) |
305 | 312 | r = { |
306 | | 'PATH_INFO': urllib.unquote(parsed[2]), |
| 313 | 'PATH_INFO': self._get_path(parsed), |
307 | 314 | 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], |
308 | 315 | 'REQUEST_METHOD': 'DELETE', |
309 | 316 | 'wsgi.input': FakePayload('') |