Ticket #5859: contrib_redirect_middleware.diff

File contrib_redirect_middleware.diff, 1006 bytes (added by E Miller <thnntn+djtrac@…>, 17 years ago)

redirect middleware w/iexact

  • middleware.py

     
    88            return response # No need to check for a redirect for non-404 responses.
    99        path = request.get_full_path()
    1010        try:
    11             r = Redirect.objects.get(site__id__exact=settings.SITE_ID, old_path=path)
     11            r = Redirect.objects.get(site__id__exact=settings.SITE_ID, old_path__iexact=path)
    1212        except Redirect.DoesNotExist:
    1313            r = None
    1414        if r is None and settings.APPEND_SLASH:
    1515            # Try removing the trailing slash.
    1616            try:
    1717                r = Redirect.objects.get(site__id__exact=settings.SITE_ID,
    18                     old_path=path[:path.rfind('/')]+path[path.rfind('/')+1:])
     18                    old_path__iexact=path[:path.rfind('/')]+path[path.rfind('/')+1:])
    1919            except Redirect.DoesNotExist:
    2020                pass
    2121        if r is not None:
Back to Top