Django

Code

Changeset 8032

Show
Ignore:
Timestamp:
07/21/08 17:13:56 (5 months ago)
Author:
mtredinnick
Message:

Fixed #7871 -- Added some more bullet-proofing in PATH_INFO determination,
since Django would like it to at least contain a '/' (rather than being an
empty string).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/handlers/modpython.py

    r8015 r8032  
    3232        else: 
    3333            self.path_info = self.path 
     34        if not self.path_info: 
     35            # Django prefers empty paths to be '/', rather than '', to give us 
     36            # a common start character for URL patterns. So this is a little 
     37            # naughty, but also pretty harmless. 
     38            self.path_info = u'/' 
    3439 
    3540    def __repr__(self): 
  • django/trunk/django/core/handlers/wsgi.py

    r8015 r8032  
    7777    def __init__(self, environ): 
    7878        script_name = base.get_script_name(environ) 
    79         path_info = force_unicode(environ.get('PATH_INFO', '/')) 
     79        path_info = force_unicode(environ.get('PATH_INFO', u'/')) 
     80        if not path_info: 
     81            # Sometimes PATH_INFO exists, but is empty (e.g. accessing 
     82            # the SCRIPT_NAME URL without a trailing slash). We really need to 
     83            # operate as if they'd requested '/'. Not amazingly nice to force 
     84            # the path like this, but should be harmless. 
     85            path_info = u'/' 
    8086        self.environ = environ 
    8187        self.path_info = path_info