1
0
mirror of https://github.com/django/django.git synced 2025-10-28 16:16:12 +00:00

First part of setting request.path correctly.

Still needs:
    - testing
    - docs changes
    - some way of fixing reverse().


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7991 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2008-07-19 19:32:01 +00:00
parent e8dd3855c1
commit b653cdcfb2
6 changed files with 45 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ except ImportError:
from django import http
from django.core import signals
from django.core.handlers.base import BaseHandler
from django.core.handlers import base
from django.dispatch import dispatcher
from django.utils import datastructures
from django.utils.encoding import force_unicode
@@ -74,9 +74,14 @@ def safe_copyfileobj(fsrc, fdst, length=16*1024, size=0):
class WSGIRequest(http.HttpRequest):
def __init__(self, environ):
script_name = base.get_script_name()
path_info = force_unicode(environ.get('PATH_INFO', '/'))
self.environ = environ
self.path = force_unicode(environ['PATH_INFO'])
self.path_info = path_info
self.path = '%s%s' % (script_name, path_info)
self.META = environ
self.META['PATH_INFO'] = path_info
self.META['SCRIPT_NAME'] = script_name
self.method = environ['REQUEST_METHOD'].upper()
def __repr__(self):
@@ -178,7 +183,7 @@ class WSGIRequest(http.HttpRequest):
REQUEST = property(_get_request)
raw_post_data = property(_get_raw_post_data)
class WSGIHandler(BaseHandler):
class WSGIHandler(base.BaseHandler):
initLock = Lock()
request_class = WSGIRequest