Ticket #11903: bug11903.patch

File bug11903.patch, 1.7 KB (added by fgallina, 5 years ago)

patch with test for bug 11903

  • django/core/handlers/wsgi.py

     
    1111from django.core.urlresolvers import set_script_prefix
    1212from django.utils import datastructures
    1313from django.utils.encoding import force_unicode, iri_to_uri
     14from django.utils.http import urlquote
    1415
    1516# See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
    1617STATUS_CODE_TEXT = {
     
    8788            path_info = u'/'
    8889        self.environ = environ
    8990        self.path_info = path_info
    90         self.path = '%s%s' % (script_name, path_info)
     91        self.path = '%s%s' % (urlquote(script_name), urlquote(path_info))
    9192        self.META = environ
    9293        self.META['PATH_INFO'] = path_info
    9394        self.META['SCRIPT_NAME'] = script_name
  • tests/regressiontests/bug11903/tests.py

     
     1from django.core.handlers.wsgi import WSGIRequest
     2from unittest import TestCase
     3
     4class TestBug11903(TestCase):
     5
     6    def testResult(self):
     7        wsgi_request = WSGIRequest({'PATH_INFO': '/some special path',
     8                                    'REQUEST_METHOD': 'bogus',
     9                                    'SCRIPT_NAME': u'script'})
     10        self.assertEquals(wsgi_request.path, u'script/some%20special%20path')
Back to Top