﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16494	HttpResponse should raise an error if given a non-string object without `__iter__`	matt@…	Paul McMillan	"where response = 
{{{
<class 'django.http.HttpResponse'>
}}} 
and  response._container = 
{{{
[<Response><Speak loop=""1"" voice=""slt"">Hello Friend</Speak></Response>]
}}}

Content type = text/xml

{{{#!python
matt@dragoon:~/Projects/my_project$ python manage.py test my_app
Creating test database for alias 'default'...
======================================================================
ERROR: test_hello (my_app.tests.RestTestCase)
----------------------------------------------------------------------
print response
Traceback (most recent call last):
  File ""/Users/matt/Projects/my_project/my_app/tests.py"", line 22, in test_hello
    print result.content
  File ""/Library/Python/2.6/site-packages/django/http/__init__.py"", line 596, in _get_content
    return smart_str(''.join(self._container), self._charset)
TypeError: sequence item 0: expected string, Response found
----------------------------------------------------------------------
Ran 1 test in 3.177s

FAILED (errors=1)
Destroying test database for alias 'default'...
}}}

The following patch corrected the issue for me

{{{
django/http/__init__.py
593,595c593
<     def _get_content(self):        if self.has_header('Content-Encoding'):
<             return ''.join(self._container)
<         return smart_str(''.join(self._container), self._charset)
---
>     def _get_content(self):
}}}"	Bug	closed	HTTP handling	1.3	Normal	fixed		anssi.kaariainen@…	Accepted	1	0	0	0	0	0
