Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #16848 - Adjusted SimpleTemplateResponse.__init__ to be less br…

…ittle.

Could have reverted r16830 instead, but HttpResponse shouldn't have to dance
around and do non-obvious things to keep TemplateResponse happy,
TemplateResponse should be robust against the possibility that
HttpResponse.__init__ might set self.content.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16831 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ce48e8e9400c7030e5a351efde172e4bd3230966 1 parent 2fa433e
@carljm carljm authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 django/template/response.py
View
12 django/template/response.py
@@ -21,10 +21,6 @@ def __init__(self, template, context=None, mimetype=None, status=None,
self.template_name = template
self.context_data = context
- # _is_rendered tracks whether the template and context has been
- # baked into a final response.
- self._is_rendered = False
-
self._post_render_callbacks = []
# content argument doesn't make sense here because it will be replaced
@@ -33,6 +29,14 @@ def __init__(self, template, context=None, mimetype=None, status=None,
super(SimpleTemplateResponse, self).__init__('', mimetype, status,
content_type)
+ # _is_rendered tracks whether the template and context has been baked
+ # into a final response.
+ # Super __init__ doesn't know any better than to set self.content to
+ # the empty string we just gave it, which wrongly sets _is_rendered
+ # True, so we initialize it to False after the call to super __init__.
+ self._is_rendered = False
+
+
def __getstate__(self):
"""Pickling support function.
Please sign in to comment.
Something went wrong with that request. Please try again.