Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #10470 -- Fixed a race condition in middleware initialization.

Thanks to Travis Terry and mrts.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10036 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6483fdf1fadf5f577fc7eef07bb4ec5c920e44f8 1 parent a152909
Malcolm Tredinnick authored March 12, 2009

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. 7  django/core/handlers/base.py
7  django/core/handlers/base.py
@@ -24,10 +24,11 @@ def load_middleware(self):
24 24
         """
25 25
         from django.conf import settings
26 26
         from django.core import exceptions
27  
-        self._request_middleware = []
28 27
         self._view_middleware = []
29 28
         self._response_middleware = []
30 29
         self._exception_middleware = []
  30
+
  31
+        request_middleware = []
31 32
         for middleware_path in settings.MIDDLEWARE_CLASSES:
32 33
             try:
33 34
                 dot = middleware_path.rindex('.')
@@ -57,6 +58,10 @@ def load_middleware(self):
57 58
             if hasattr(mw_instance, 'process_exception'):
58 59
                 self._exception_middleware.insert(0, mw_instance.process_exception)
59 60
 
  61
+        # We only assign to this when initialization is complete as it is used
  62
+        # as a flag for initialization being complete.
  63
+        self._request_middleware = request_middleware
  64
+
60 65
     def get_response(self, request):
61 66
         "Returns an HttpResponse object for the given HttpRequest"
62 67
         from django.core import exceptions, urlresolvers

0 notes on commit 6483fdf

Please sign in to comment.
Something went wrong with that request. Please try again.