1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #16004 - csrf_protect does not send cookie if view returns TemplateResponse

The root bug was in decorator_from_middleware, and the fix also corrects
bugs with gzip_page and other decorators.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16276 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Luke Plant
2011-05-24 21:28:43 +00:00
parent d7036e52ab
commit a482cc0ba3
5 changed files with 88 additions and 7 deletions

View File

@@ -92,11 +92,14 @@ class SimpleTemplateResponse(HttpResponse):
Returns the baked response instance.
"""
retval = self
if not self._is_rendered:
self._set_content(self.rendered_content)
for post_callback in self._post_render_callbacks:
post_callback(self)
return self
newretval = post_callback(retval)
if newretval is not None:
retval = newretval
return retval
is_rendered = property(lambda self: self._is_rendered)