Ticket #10470: thread-safe-handlers_minimal-patch.diff

File thread-safe-handlers_minimal-patch.diff, 1.4 KB (added by mrts, 16 years ago)

Minimal changes that assure thread-safety

  • django/core/handlers/base.py

     
    2424        """
    2525        from django.conf import settings
    2626        from django.core import exceptions
    27         self._request_middleware = []
     27
     28        # also serves as initialization guard
     29        _request_middleware = []
     30
    2831        self._view_middleware = []
    2932        self._response_middleware = []
    3033        self._exception_middleware = []
     
    4952                continue
    5053
    5154            if hasattr(mw_instance, 'process_request'):
    52                 self._request_middleware.append(mw_instance.process_request)
     55                _request_middleware.append(mw_instance.process_request)
    5356            if hasattr(mw_instance, 'process_view'):
    5457                self._view_middleware.append(mw_instance.process_view)
    5558            if hasattr(mw_instance, 'process_response'):
     
    5760            if hasattr(mw_instance, 'process_exception'):
    5861                self._exception_middleware.insert(0, mw_instance.process_exception)
    5962
     63        self._request_middleware = _request_middleware
     64
    6065    def get_response(self, request):
    6166        "Returns an HttpResponse object for the given HttpRequest"
    6267        from django.core import exceptions, urlresolvers
Back to Top