mirror of
				https://github.com/django/django.git
				synced 2025-10-30 17:16:10 +00:00 
			
		
		
		
	Fixed #4909 -- Fixed a race condition with middleware initialisation in multi-threaded setups. Thanks, colin@owlfish.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5868 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		
							
								
								
									
										1
									
								
								AUTHORS
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								AUTHORS
									
									
									
									
									
								
							| @@ -78,6 +78,7 @@ answer newbie questions, and generally made Django that much better: | ||||
|     Bryan Chow <bryan at verdjn dot com> | ||||
|     Michal Chruszcz <troll@pld-linux.org> | ||||
|     Ian Clelland <clelland@gmail.com> | ||||
|     colin@owlfish.com | ||||
|     crankycoder@gmail.com | ||||
|     Pete Crosier <pete.crosier@gmail.com> | ||||
|     Matt Croydon <http://www.postneo.com/> | ||||
|   | ||||
| @@ -6,6 +6,7 @@ from django.utils.encoding import force_unicode | ||||
| from django import http | ||||
| from pprint import pformat | ||||
| from shutil import copyfileobj | ||||
| from threading import Lock | ||||
| try: | ||||
|     from cStringIO import StringIO | ||||
| except ImportError: | ||||
| @@ -176,13 +177,19 @@ class WSGIRequest(http.HttpRequest): | ||||
|     raw_post_data = property(_get_raw_post_data) | ||||
|  | ||||
| class WSGIHandler(BaseHandler): | ||||
|     initLock = Lock() | ||||
|  | ||||
|     def __call__(self, environ, start_response): | ||||
|         from django.conf import settings | ||||
|  | ||||
|         # Set up middleware if needed. We couldn't do this earlier, because | ||||
|         # settings weren't available. | ||||
|         if self._request_middleware is None: | ||||
|             self.initLock.acquire() | ||||
|             # Check that middleware is still uninitialised. | ||||
|             if self._request_middleware is None: | ||||
|                 self.load_middleware() | ||||
|             self.initLock.release() | ||||
|  | ||||
|         dispatcher.send(signal=signals.request_started) | ||||
|         try: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user