magic-removal: changed explicit settings import to qualified settings import in django.core.handlers
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2001 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
179beccfea
commit
02ea6a4074
|
@ -51,7 +51,7 @@ class BaseHandler:
|
||||||
"Returns an HttpResponse object for the given HttpRequest"
|
"Returns an HttpResponse object for the given HttpRequest"
|
||||||
from django.core import exceptions, urlresolvers
|
from django.core import exceptions, urlresolvers
|
||||||
from django.core.mail import mail_admins
|
from django.core.mail import mail_admins
|
||||||
from django.conf.settings import DEBUG, INTERNAL_IPS, ROOT_URLCONF
|
from django.conf import settings
|
||||||
|
|
||||||
# Apply request middleware
|
# Apply request middleware
|
||||||
for middleware_method in self._request_middleware:
|
for middleware_method in self._request_middleware:
|
||||||
|
@ -59,7 +59,7 @@ class BaseHandler:
|
||||||
if response:
|
if response:
|
||||||
return response
|
return response
|
||||||
|
|
||||||
resolver = urlresolvers.RegexURLResolver(r'^/', ROOT_URLCONF)
|
resolver = urlresolvers.RegexURLResolver(r'^/', settings.ROOT_URLCONF)
|
||||||
try:
|
try:
|
||||||
callback, callback_args, callback_kwargs = resolver.resolve(path)
|
callback, callback_args, callback_kwargs = resolver.resolve(path)
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class BaseHandler:
|
||||||
|
|
||||||
return response
|
return response
|
||||||
except http.Http404, e:
|
except http.Http404, e:
|
||||||
if DEBUG:
|
if settings.DEBUG:
|
||||||
return self.get_technical_error_response(request, is404=True, exception=e)
|
return self.get_technical_error_response(request, is404=True, exception=e)
|
||||||
else:
|
else:
|
||||||
callback, param_dict = resolver.resolve404()
|
callback, param_dict = resolver.resolve404()
|
||||||
|
@ -95,12 +95,12 @@ class BaseHandler:
|
||||||
except exceptions.PermissionDenied:
|
except exceptions.PermissionDenied:
|
||||||
return http.HttpResponseForbidden('<h1>Permission denied</h1>')
|
return http.HttpResponseForbidden('<h1>Permission denied</h1>')
|
||||||
except: # Handle everything else, including SuspiciousOperation, etc.
|
except: # Handle everything else, including SuspiciousOperation, etc.
|
||||||
if DEBUG:
|
if settings.DEBUG:
|
||||||
return self.get_technical_error_response(request)
|
return self.get_technical_error_response(request)
|
||||||
else:
|
else:
|
||||||
receivers = dispatcher.send(signal=signals.got_request_exception)
|
receivers = dispatcher.send(signal=signals.got_request_exception)
|
||||||
# When DEBUG is False, send an error message to the admins.
|
# When DEBUG is False, send an error message to the admins.
|
||||||
subject = 'Error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in INTERNAL_IPS and 'internal' or 'EXTERNAL'), getattr(request, 'path', ''))
|
subject = 'Error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS and 'internal' or 'EXTERNAL'), getattr(request, 'path', ''))
|
||||||
try:
|
try:
|
||||||
request_repr = repr(request)
|
request_repr = repr(request)
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in New Issue