magic-removal: changed explicit settings import to qualified settings import django.contrib.redirects

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1993 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Georg Bauer 2006-01-16 15:01:26 +00:00
parent 22012296bd
commit 91f21f0641
1 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
from django.contrib.redirects.models import Redirect
from django import http
from django.conf.settings import APPEND_SLASH, SITE_ID
from django.conf import settings
class RedirectFallbackMiddleware:
def process_response(self, request, response):
@ -8,13 +8,13 @@ class RedirectFallbackMiddleware:
return response # No need to check for a redirect for non-404 responses.
path = request.get_full_path()
try:
r = Redirect.objects.get_object(site__id__exact=SITE_ID, old_path__exact=path)
r = Redirect.objects.get_object(site__id__exact=settings.SITE_ID, old_path__exact=path)
except Redirect.DoesNotExist:
r = None
if r is None and APPEND_SLASH:
if r is None and settings.APPEND_SLASH:
# Try removing the trailing slash.
try:
r = Redirect.objects.get_object(site__id__exact=SITE_ID,
r = Redirect.objects.get_object(site__id__exact=settings.SITE_ID,
old_path__exact=path[:path.rfind('/')]+path[path.rfind('/')+1:])
except Redirect.DoesNotExist:
pass