Ticket #5859: contrib_redirect_middleware.diff
File contrib_redirect_middleware.diff, 1006 bytes (added by , 17 years ago) |
---|
-
middleware.py
8 8 return response # No need to check for a redirect for non-404 responses. 9 9 path = request.get_full_path() 10 10 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) 12 12 except Redirect.DoesNotExist: 13 13 r = None 14 14 if r is None and settings.APPEND_SLASH: 15 15 # Try removing the trailing slash. 16 16 try: 17 17 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:]) 19 19 except Redirect.DoesNotExist: 20 20 pass 21 21 if r is not None: