Fixed tabs in source, stupid emacs.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9817 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Luke Plant 2009-02-07 19:32:37 +00:00
parent 95ed07e888
commit 0326574d0e
2 changed files with 12 additions and 12 deletions

View File

@ -65,8 +65,8 @@ class CsrfResponseMiddleware(object):
session.
"""
def process_response(self, request, response):
if getattr(response, 'csrf_exempt', False):
return response
if getattr(response, 'csrf_exempt', False):
return response
csrf_token = None
try:
@ -133,8 +133,8 @@ def csrf_response_exempt(view_func):
"""
def wrapped_view(*args, **kwargs):
resp = view_func(*args, **kwargs)
resp.csrf_exempt = True
return resp
resp.csrf_exempt = True
return resp
return wraps(view_func)(wrapped_view)
def csrf_view_exempt(view_func):

View File

@ -63,7 +63,7 @@ class CsrfMiddlewareTest(TestCase):
"""
req = self._get_GET_no_session_request()
resp = self._get_post_form_response()
resp_content = resp.content # needed because process_response modifies resp
resp_content = resp.content # needed because process_response modifies resp
resp2 = CsrfMiddleware().process_response(req, resp)
self.assertEquals(resp_content, resp2.content)
@ -73,7 +73,7 @@ class CsrfMiddlewareTest(TestCase):
"""
req = self._get_GET_session_request()
resp = self._get_post_form_response()
resp_content = resp.content # needed because process_response modifies resp
resp_content = resp.content # needed because process_response modifies resp
resp2 = CsrfMiddleware().process_response(req, resp)
self.assertNotEqual(resp_content, resp2.content)
self._check_token_present(resp2)
@ -84,18 +84,18 @@ class CsrfMiddlewareTest(TestCase):
"""
req = self._get_GET_no_session_request() # no session in request
resp = self._get_new_session_response() # but new session started
resp_content = resp.content # needed because process_response modifies resp
resp_content = resp.content # needed because process_response modifies resp
resp2 = CsrfMiddleware().process_response(req, resp)
self.assertNotEqual(resp_content, resp2.content)
self._check_token_present(resp2)
def test_process_response_exempt_view(self):
"""
Check that no post processing is done for an exempt view
"""
"""
Check that no post processing is done for an exempt view
"""
req = self._get_POST_session_request()
resp = csrf_exempt(self.get_view())(req)
resp_content = resp.content
resp = csrf_exempt(self.get_view())(req)
resp_content = resp.content
resp2 = CsrfMiddleware().process_response(req, resp)
self.assertEquals(resp_content, resp2.content)