Ticket #285: script_name_path_info.diff

File script_name_path_info.diff, 1.8 KB (added by jmelesky, 8 years ago)

try and accomodate request.path appropriately in mod_python and under wsgi, add request.full_path for script_name plus path

  • django/http/__init__.py

     
    2626    def __init__(self):
    2727        self.GET, self.POST, self.COOKIES, self.META, self.FILES = {}, {}, {}, {}, {}
    2828        self.path = ''
     29        self.full_path = ''
    2930        self.method = None
    3031
    3132    def __repr__(self):
  • django/core/handlers/wsgi.py

     
    7575class WSGIRequest(http.HttpRequest):
    7676    def __init__(self, environ):
    7777        self.environ = environ
    78         self.path = force_unicode(environ['PATH_INFO'])
     78        self.path = force_unicode(environ.get('PATH_INFO', '/'))
     79        self.full_path = (force_unicode(environ.get('SCRIPT_NAME', ''))
     80                          + force_unicode(environ.get('PATH_INFO', '/')))
    7981        self.META = environ
    8082        self.method = environ['REQUEST_METHOD'].upper()
    8183
  • django/core/handlers/modpython.py

     
    1414class ModPythonRequest(http.HttpRequest):
    1515    def __init__(self, req):
    1616        self._req = req
    17         self.path = force_unicode(req.uri)
     17        self.full_path = force_unicode(req.uri)
     18        root = req.options.get('django.root', '')
     19        if root and req.uri.startswith(root):
     20            self.path = force_unicode(req.uri[len(root):])
     21        else:
     22            self.path = self.full_path
    1823
    1924    def __repr__(self):
    2025        # Since this is called as part of error handling, we need to be very
Back to Top