Author: carljm Date: 2011-09-15 00:26:35 -0700 (Thu, 15 Sep 2011) New Revision: 16831
Modified: django/trunk/django/template/response.py Log: Fixed #16848 - Adjusted SimpleTemplateResponse.__init__ to be less brittle. 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. Modified: django/trunk/django/template/response.py =================================================================== --- django/trunk/django/template/response.py 2011-09-14 23:58:12 UTC (rev 16830) +++ django/trunk/django/template/response.py 2011-09-15 07:26:35 UTC (rev 16831) @@ -21,10 +21,6 @@ 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 @@ 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. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.