Ticket #12909: 12909.diff
File 12909.diff, 1.8 KB (added by , 14 years ago) |
---|
-
django/core/handlers/wsgi.py
11 11 from django.core.urlresolvers import set_script_prefix 12 12 from django.utils import datastructures 13 13 from django.utils.encoding import force_unicode, iri_to_uri 14 import sys 14 15 15 16 # See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 16 17 STATUS_CODE_TEXT = { … … 220 221 221 222 def __call__(self, environ, start_response): 222 223 from django.conf import settings 224 from django.core import urlresolvers 223 225 224 226 # Set up middleware if needed. We couldn't do this earlier, because 225 227 # settings weren't available. … … 241 243 response = self.get_response(request) 242 244 243 245 # Apply response middleware 244 for middleware_method in self._response_middleware: 245 response = middleware_method(request, response) 246 try: 247 for middleware_method in self._response_middleware: 248 response = middleware_method(request, response) 249 except Exception,e: 250 if hasattr(request, "urlconf"): 251 urlconf = request.urlconf 252 else: 253 urlconf = settings.ROOT_URLCONF 254 urlresolvers.set_urlconf(urlconf) 255 resolver = urlresolvers.RegexURLResolver(r'^/', urlconf) 256 response = self.handle_uncaught_exception(request, resolver , sys.exc_info()) 246 257 response = self.apply_response_fixes(request, response) 247 258 finally: 248 259 signals.request_finished.send(sender=self.__class__)