Commits

Mikhail Korobov committed 666da4d

Change the way exceptions are handled in order to make code ready for django 1.3

Comments (0)

Files changed (1)

django_webtest/__init__.py

             signals.request_finished.connect(close_connection)
 
 
-class WebtestExceptionHandler(WSGIHandler):
-    """ Show original traceback instead of HTML 500 page """
-    def handle_uncaught_exception(self, request, resolver, exc_info):
-        return HttpResponseServerError(self._get_traceback(exc_info))
-
-
 class DjangoTestApp(TestApp):
 
     def __init__(self, extra_environ=None, relative_to=None):
         super(DjangoTestApp, self).__init__(self.get_wsgi_handler(), extra_environ, relative_to)
 
     def get_wsgi_handler(self):
-        return DjangoWsgiFix(AdminMediaHandler(WebtestExceptionHandler()))
+        return DjangoWsgiFix(AdminMediaHandler(WSGIHandler()))
 
     def _update_environ(self, environ, user):
         if user:
             and (optional) to disable CSRF checks
         '''
 
+        self._DEBUG_PROPAGATE_EXCEPTIONS = settings.DEBUG_PROPAGATE_EXCEPTIONS
         self._MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES[:]
         self._AUTHENTICATION_BACKENDS = settings.AUTHENTICATION_BACKENDS[:]
 
         settings.MIDDLEWARE_CLASSES = list(settings.MIDDLEWARE_CLASSES)
         settings.AUTHENTICATION_BACKENDS = list(settings.AUTHENTICATION_BACKENDS)
+        settings.DEBUG_PROPAGATE_EXCEPTIONS = True
 
         if not self.csrf_checks:
             self._disable_csrf_checks()
         ''' Restore settings to before-patching state '''
         settings.MIDDLEWARE_CLASSES = self._MIDDLEWARE_CLASSES
         settings.AUTHENTICATION_BACKENDS = self._AUTHENTICATION_BACKENDS
+        settings.DEBUG_PROPAGATE_EXCEPTIONS = self._DEBUG_PROPAGATE_EXCEPTIONS
 
     def _setup_auth(self):
         ''' Setup REMOTE_USER authorization '''