Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.0.X] Fixed #10470 -- Fixed a race condition in middleware initiali…

…zation.

Thanks to Travis Terry and mrts.

Backport of r10036 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10038 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit fdde600f42a9e5ba72f7cc0b1e84571bed477e03 1 parent 75cc96b
@malcolmt malcolmt authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 django/core/handlers/base.py
View
7 django/core/handlers/base.py
@@ -24,10 +24,11 @@ def load_middleware(self):
"""
from django.conf import settings
from django.core import exceptions
- self._request_middleware = []
self._view_middleware = []
self._response_middleware = []
self._exception_middleware = []
+
+ request_middleware = []
for middleware_path in settings.MIDDLEWARE_CLASSES:
try:
dot = middleware_path.rindex('.')
@@ -57,6 +58,10 @@ def load_middleware(self):
if hasattr(mw_instance, 'process_exception'):
self._exception_middleware.insert(0, mw_instance.process_exception)
+ # We only assign to this when initialization is complete as it is used
+ # as a flag for initialization being complete.
+ self._request_middleware = request_middleware
+
def get_response(self, request):
"Returns an HttpResponse object for the given HttpRequest"
from django.core import exceptions, urlresolvers
Please sign in to comment.
Something went wrong with that request. Please try again.