Django

Code

Changeset 7995

Show
Ignore:
Timestamp:
07/19/08 14:37:55 (2 months ago)
Author:
mtredinnick
Message:

Revert [7991] - [7993]. I was committing from the wrong branch. Sorry 'bout
that, folks. :-(

Files:

Legend:

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

    r7992 r7995  
    44from django.core import signals 
    55from django.dispatch import dispatcher 
    6 from django.utils.encoding import force_unicode 
    76 
    87class BaseHandler(object): 
     
    7574        resolver = urlresolvers.RegexURLResolver(r'^/', urlconf) 
    7675        try: 
    77             callback, callback_args, callback_kwargs = resolver.resolve( 
    78                     request.path_info) 
     76            callback, callback_args, callback_kwargs = resolver.resolve(request.path) 
    7977 
    8078            # Apply view middleware 
     
    173171        return response 
    174172 
    175 def get_script_name(environ): 
    176     """ 
    177     Returns the equivalent of the HTTP request's SCRIPT_NAME environment 
    178     variable. If Apache mod_rewrite has been used, returns what would have been 
    179     the script name prior to any rewriting (so it's the script name as seen 
    180     from the client's perspective). 
    181  
    182     Note: this isn't used by the mod_python handler, since the equivalent of 
    183     SCRIPT_NAME isn't available there. 
    184     """ 
    185     if not environ.get('DJANGO_USE_POST_REWRITE'): 
    186         # If mod_rewrite had a whack at the URL, Apache set SCRIPT_URL to 
    187         # SCRIPT_NAME before applying any rewrites. 
    188         script_url = force_unicode(environ.get('SCRIPT_URL', '')) 
    189         if script_url: 
    190             return script_url 
    191     return force_unicode(environ.get('SCRIPT_NAME', '')) 
    192  
  • django/trunk/django/core/handlers/modpython.py

    r7991 r7995  
    1717        self._req = req 
    1818        self.path = force_unicode(req.uri) 
    19         root = req.get_options().get('django.root', '') 
    20         self._django_root = root 
    21         # req.path_info isn't necessarily computed correctly in all 
    22         # circumstances (it's out of mod_python's control a bit), so we use 
    23         # req.uri and some string manipulations to get the right value. 
    24         if root and req.uri.startswith(root): 
    25             self.path_info = force_unicode(req.uri[len(root):]) 
    26         else: 
    27             self.path_info = self.path 
    2819 
    2920    def __repr__(self): 
     
    110101                'CONTENT_TYPE':      self._req.content_type, # This may be wrong 
    111102                'GATEWAY_INTERFACE': 'CGI/1.1', 
    112                 'PATH_INFO':         self.path_info, 
     103                'PATH_INFO':         self._req.path_info, 
    113104                'PATH_TRANSLATED':   None, # Not supported 
    114105                'QUERY_STRING':      self._req.args, 
     
    118109                'REMOTE_USER':       self._req.user, 
    119110                'REQUEST_METHOD':    self._req.method, 
    120                 'SCRIPT_NAME':       self._django_root, 
     111                'SCRIPT_NAME':       None, # Not supported 
    121112                'SERVER_NAME':       self._req.server.server_hostname, 
    122113                'SERVER_PORT':       self._req.server.port, 
  • django/trunk/django/core/handlers/wsgi.py

    r7991 r7995  
    88from django import http 
    99from django.core import signals 
    10 from django.core.handlers import base 
     10from django.core.handlers.base import BaseHandler 
    1111from django.dispatch import dispatcher 
    1212from django.utils import datastructures 
     
    7575class WSGIRequest(http.HttpRequest): 
    7676    def __init__(self, environ): 
    77         script_name = base.get_script_name() 
    78         path_info = force_unicode(environ.get('PATH_INFO', '/')) 
    7977        self.environ = environ 
    80         self.path_info = path_info 
    81         self.path = '%s%s' % (script_name, path_info) 
     78        self.path = force_unicode(environ['PATH_INFO']) 
    8279        self.META = environ 
    83         self.META['PATH_INFO'] = path_info 
    84         self.META['SCRIPT_NAME'] = script_name 
    8580        self.method = environ['REQUEST_METHOD'].upper() 
    8681 
     
    184179    raw_post_data = property(_get_raw_post_data) 
    185180 
    186 class WSGIHandler(base.BaseHandler): 
     181class WSGIHandler(BaseHandler): 
    187182    initLock = Lock() 
    188183    request_class = WSGIRequest 
  • django/trunk/django/core/urlresolvers.py

    r7991 r7995  
    292292    return get_resolver(urlconf).resolve(path) 
    293293 
    294 def reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=u'/'): 
     294def reverse(viewname, urlconf=None, args=None, kwargs=None): 
    295295    args = args or [] 
    296296    kwargs = kwargs or {} 
    297     return iri_to_uri(prefix + 
    298             get_resolver(urlconf).reverse(viewname, *args, **kwargs)) 
     297    return iri_to_uri(u'/' + get_resolver(urlconf).reverse(viewname, *args, **kwargs)) 
    299298 
    300299def clear_url_caches(): 
  • django/trunk/django/http/__init__.py

    r7991 r7995  
    3232        self.GET, self.POST, self.COOKIES, self.META, self.FILES = {}, {}, {}, {}, {} 
    3333        self.path = '' 
    34         self.path_info = '' 
    3534        self.method = None 
    3635 
     
    444443    else: 
    445444        return s 
    446  
  • django/trunk/django/test/client.py

    r7991 r7995  
    191191            'QUERY_STRING':      '', 
    192192            'REQUEST_METHOD':    'GET', 
    193             'SCRIPT_NAME':       ''
     193            'SCRIPT_NAME':       None
    194194            'SERVER_NAME':       'testserver', 
    195195            'SERVER_PORT':       80, 
  • django/trunk/django/utils/translation/trans_real.py

    r7993 r7995  
    99 
    1010from django.utils.safestring import mark_safe, SafeData 
    11 from django.utils.thread_support import currentThread 
     11 
     12try: 
     13    import threading 
     14    hasThreads = True 
     15except ImportError: 
     16    hasThreads = False 
     17 
     18if hasThreads: 
     19    currentThread = threading.currentThread 
     20else: 
     21    def currentThread(): 
     22        return 'no threading' 
    1223 
    1324# Translations are cached in a dictionary for every language+app tuple.