Ticket #8381: 8381-r8423.diff

File 8381-r8423.diff, 964 bytes (added by Joost Cassee, 16 years ago)
  • django/middleware/common.py

     
    4343        # Check for a redirect based on settings.APPEND_SLASH
    4444        # and settings.PREPEND_WWW
    4545        host = request.get_host()
    46         old_url = [host, request.path]
     46        old_url = [host, request.path_info]
    4747        new_url = old_url[:]
    4848
    4949        if (settings.PREPEND_WWW and old_url[0] and
     
    5454        # trailing slash and there is no pattern for the current path
    5555        if settings.APPEND_SLASH and (not old_url[1].endswith('/')):
    5656            try:
    57                 urlresolvers.resolve(request.path)
     57                urlresolvers.resolve(request.path_info)
    5858            except urlresolvers.Resolver404:
    5959                new_url[1] = new_url[1] + '/'
    6060                if settings.DEBUG and request.method == 'POST':
Back to Top