Ticket #3553: 3553.diff
File 3553.diff, 6.4 KB (added by , 16 years ago) |
---|
-
django/test/client.py
265 265 r = { 266 266 'CONTENT_TYPE': 'text/html; charset=utf-8', 267 267 'PATH_INFO': urllib.unquote(parsed[2]), 268 'REQUEST_URI': parsed[2], 268 269 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], 269 270 'REQUEST_METHOD': 'GET', 270 271 'wsgi.input': FakePayload('') … … 287 288 'CONTENT_LENGTH': len(post_data), 288 289 'CONTENT_TYPE': content_type, 289 290 'PATH_INFO': urllib.unquote(parsed[2]), 291 'REQUEST_URI': parsed[2], 290 292 'QUERY_STRING': parsed[4], 291 293 'REQUEST_METHOD': 'POST', 292 294 'wsgi.input': FakePayload(post_data), … … 303 305 r = { 304 306 'CONTENT_TYPE': 'text/html; charset=utf-8', 305 307 'PATH_INFO': urllib.unquote(parsed[2]), 308 'REQUEST_URI': parsed[2], 306 309 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], 307 310 'REQUEST_METHOD': 'HEAD', 308 311 'wsgi.input': FakePayload('') … … 318 321 parsed = urlparse(path) 319 322 r = { 320 323 'PATH_INFO': urllib.unquote(parsed[2]), 324 'REQUEST_URI': parsed[2], 321 325 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], 322 326 'REQUEST_METHOD': 'OPTIONS', 323 327 'wsgi.input': FakePayload('') … … 340 344 'CONTENT_LENGTH': len(post_data), 341 345 'CONTENT_TYPE': content_type, 342 346 'PATH_INFO': urllib.unquote(parsed[2]), 347 'REQUEST_URI': parsed[2], 343 348 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], 344 349 'REQUEST_METHOD': 'PUT', 345 350 'wsgi.input': FakePayload(post_data), … … 355 360 parsed = urlparse(path) 356 361 r = { 357 362 'PATH_INFO': urllib.unquote(parsed[2]), 363 'REQUEST_URI': parsed[2], 358 364 'QUERY_STRING': urlencode(data, doseq=True) or parsed[4], 359 365 'REQUEST_METHOD': 'DELETE', 360 366 'wsgi.input': FakePayload('') -
django/core/servers/basehttp.py
566 566 else: 567 567 path,query = self.path,'' 568 568 569 env['PATH_INFO'] = urllib.unquote (path)569 env['PATH_INFO'] = urllib.unquote_plus(path) 570 570 env['QUERY_STRING'] = query 571 571 env['REMOTE_ADDR'] = self.client_address[0] 572 572 -
django/core/handlers/wsgi.py
1 1 from threading import Lock 2 2 from pprint import pformat 3 import urllib 3 4 try: 4 5 from cStringIO import StringIO 5 6 except ImportError: … … 75 76 class WSGIRequest(http.HttpRequest): 76 77 def __init__(self, environ): 77 78 script_name = base.get_script_name(environ) 78 path_info = force_unicode(environ.get('PATH_INFO', u'/')) 79 80 real_path = environ.get('REQUEST_URI', u'/').split('?')[0] 81 path_info = force_unicode( urllib.unquote_plus(real_path) ) 79 82 if not path_info or path_info == script_name: 80 83 # Sometimes PATH_INFO exists, but is empty (e.g. accessing 81 84 # the SCRIPT_NAME URL without a trailing slash). We really need to -
django/core/handlers/modpython.py
1 1 import os 2 2 from pprint import pformat 3 import urllib 3 4 4 5 from django import http 5 6 from django.core import signals … … 20 21 # and PATH_INFO values. This causes problems when we compute path_info, 21 22 # below. For now, don't use script names that will be subject to 22 23 # encoding/decoding. 23 self.path = force_unicode(req.uri) 24 25 if req.unparsed_uri: 26 req_uri = urllib.unquote_plus(req.unparsed_uri.split('?')[0]) 27 else: 28 req_uri = req.uri 29 30 self.path = force_unicode(req_uri) 24 31 root = req.get_options().get('django.root', '') 25 32 self.django_root = root 26 33 # req.path_info isn't necessarily computed correctly in all 27 34 # circumstances (it's out of mod_python's control a bit), so we use 28 # req .uri and some string manipulations to get the right value.29 if root and req .uri.startswith(root):30 self.path_info = force_unicode(req .uri[len(root):])35 # req_uri and some string manipulations to get the right value. 36 if root and req_uri.startswith(root): 37 self.path_info = force_unicode(req_uri[len(root):]) 31 38 else: 32 39 self.path_info = self.path 33 40 if not self.path_info: -
tests/regressiontests/file_uploads/tests.py
100 100 'CONTENT_LENGTH': len(payload), 101 101 'CONTENT_TYPE': client.MULTIPART_CONTENT, 102 102 'PATH_INFO': "/file_uploads/echo/", 103 'REQUEST_URI': "/file_uploads/echo/", 103 104 'REQUEST_METHOD': 'POST', 104 105 'wsgi.input': client.FakePayload(payload), 105 106 } … … 127 128 'CONTENT_LENGTH': len(payload), 128 129 'CONTENT_TYPE': client.MULTIPART_CONTENT, 129 130 'PATH_INFO': "/file_uploads/echo/", 131 'REQUEST_URI': "/file_uploads/echo/", 130 132 'REQUEST_METHOD': 'POST', 131 133 'wsgi.input': client.FakePayload(payload), 132 134 } -
tests/regressiontests/requests/tests.py
25 25 ... return {} 26 26 >>> req = Dummy() 27 27 >>> req.uri = 'bogus' 28 >>> req.unparsed_uri = 'bogus' 28 29 >>> print repr(FakeModPythonRequest(req)) 29 30 <ModPythonRequest 30 31 path:bogus,