mirror of https://github.com/django/django.git
Fixed #6094 again -- fixed broken unit tests. Thanks, isagalaev
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12186 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
2ef52d0ce2
commit
7d9de178e7
|
@ -72,13 +72,8 @@ class BaseHandler(object):
|
|||
try:
|
||||
# Reset the urlconf for this thread.
|
||||
urlresolvers.set_urlconf(None)
|
||||
|
||||
# Get urlconf from request object, if available. Otherwise use default.
|
||||
urlconf = getattr(request, "urlconf", settings.ROOT_URLCONF)
|
||||
|
||||
# Set the urlconf for this thread to the one specified above.
|
||||
urlresolvers.set_urlconf(urlconf)
|
||||
resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
|
||||
# Obtain a default resolver. It's needed early for handling 404's.
|
||||
resolver = urlresolvers.RegexURLResolver(r'^/', None)
|
||||
|
||||
# Apply request middleware
|
||||
for middleware_method in self._request_middleware:
|
||||
|
@ -86,6 +81,13 @@ class BaseHandler(object):
|
|||
if response:
|
||||
return response
|
||||
|
||||
# Get urlconf from request object, if available. Otherwise use default.
|
||||
urlconf = getattr(request, "urlconf", settings.ROOT_URLCONF)
|
||||
# Set the urlconf for this thread to the one specified above.
|
||||
urlresolvers.set_urlconf(urlconf)
|
||||
# Reset the resolver with a possibly new urlconf
|
||||
resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
|
||||
|
||||
callback, callback_args, callback_kwargs = resolver.resolve(
|
||||
request.path_info)
|
||||
|
||||
|
|
|
@ -8,15 +8,13 @@ class RequestMiddleware(object):
|
|||
raise Exception('Exception')
|
||||
|
||||
class MiddlewareExceptionTest(TestCase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(MiddlewareExceptionTest, self).__init__(*args, **kwargs)
|
||||
def setUp(self):
|
||||
self.exceptions = []
|
||||
got_request_exception.connect(self._on_request_exception)
|
||||
|
||||
def setUp(self):
|
||||
self.client.handler.load_middleware()
|
||||
|
||||
def tearDown(self):
|
||||
got_request_exception.disconnect(self._on_request_exception)
|
||||
self.exceptions = []
|
||||
|
||||
def _on_request_exception(self, sender, request, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue