Ticket #5157: apache_redirect.diff
File apache_redirect.diff, 2.1 KB (added by , 17 years ago) |
---|
-
http/__init__.py
16 16 class Http404(Exception): 17 17 pass 18 18 19 class HttpInternalRedirect(Exception): 20 "Redirect Apache to handle static file" 21 def __init__(self, path): 22 self.path = path 23 19 24 class HttpRequest(object): 20 25 "A basic HTTP request" 21 26 -
core/handlers/base.py
105 105 return http.HttpResponseForbidden('<h1>Permission denied</h1>') 106 106 except SystemExit: 107 107 pass # See http://code.djangoproject.com/ticket/1023 108 except http.HttpInternalRedirect, e: 109 raise e # re-raise exception to avoid default exception handler 108 110 except: # Handle everything else, including SuspiciousOperation, etc. 109 111 if settings.DEBUG: 110 112 from django.views import debug -
core/handlers/modpython.py
1 from django.core.exceptions import * 1 2 from django.core.handlers.base import BaseHandler 2 3 from django.core import signals 3 4 from django.dispatch import dispatcher … … 148 149 dispatcher.send(signal=signals.request_started) 149 150 try: 150 151 request = ModPythonRequest(req) 151 response = self.get_response(request)152 152 153 # check for a redirect to allow Apache to efficiently handle static files 154 try: 155 response = self.get_response(request) 156 except http.HttpInternalRedirect, e: 157 req.internal_redirect(e.path) 158 return mod_python.apache.DECLINED 159 153 160 # Apply response middleware 154 161 for middleware_method in self._response_middleware: 155 162 response = middleware_method(request, response)