Code

Ticket #3414: wsgi_path_from_many_params.diff

File wsgi_path_from_many_params.diff, 790 bytes (added by Jordi Funollet <jordi.f@…>, 7 years ago)

Patch against [5823]

Line 
1Index: django/core/handlers/wsgi.py
2===================================================================
3--- django/core/handlers/wsgi.py        (revision 5823)
4+++ django/core/handlers/wsgi.py        (working copy)
5@@ -74,7 +74,12 @@
6 class WSGIRequest(http.HttpRequest):
7     def __init__(self, environ):
8         self.environ = environ
9-        self.path = force_unicode(environ['PATH_INFO'])
10+        if environ['PATH_INFO']:
11+            self.path = force_unicode(environ['PATH_INFO'])
12+        elif environ.has_key('REDIRECT_URL') and environ['REDIRECT_URL']:
13+            self.path = force_unicode(environ['REDIRECT_URL'])
14+        else:
15+            self.path = force_unicode(environ.get('REQUEST_URI', '/'))
16         self.META = environ
17         self.method = environ['REQUEST_METHOD'].upper()
18