Ticket #9172: django-trunk-remove-csrf-in-test-client.patch
File django-trunk-remove-csrf-in-test-client.patch, 916 bytes (added by , 16 years ago) |
---|
-
django/test/client.py
57 57 58 58 # Set up middleware if needed. We couldn't do this earlier, because 59 59 # settings weren't available. 60 61 # remove csrf middleware because the test client doesn't, and doesn't 62 # need to, emulate a browser to the extent necessary to pass the csrf 63 # test. 64 if 'django.contrib.csrf.middleware.CsrfMiddleware' \ 65 in settings.MIDDLEWARE_CLASSES: 66 middleware_classes = list(settings.MIDDLEWARE_CLASSES) 67 middleware_classes.remove('django.contrib.csrf.middleware.CsrfMiddleware') 68 settings.MIDDLEWARE_CLASSES = tuple(middleware_classes) 69 60 70 if self._request_middleware is None: 61 71 self.load_middleware() 62 72