Ticket #9403: httpResp_set_content.diff
File httpResp_set_content.diff, 1.3 KB (added by , 16 years ago) |
---|
-
django/http/__init__.py
277 277 if not content_type: 278 278 content_type = "%s; charset=%s" % (settings.DEFAULT_CONTENT_TYPE, 279 279 settings.DEFAULT_CHARSET) 280 if not isinstance(content, basestring) and hasattr(content, '__iter__'): 281 self._container = content 282 self._is_string = False 283 else: 284 self._container = [content] 285 self._is_string = True 280 281 self.content = content 286 282 self.cookies = SimpleCookie() 287 283 if status: 288 284 self.status_code = status … … 359 355 return smart_str(''.join(self._container), self._charset) 360 356 361 357 def _set_content(self, value): 362 self._container = [value] 363 self._is_string = True 364 358 if not isinstance(value, basestring) and hasattr(value, '__iter__'): 359 self._container = value 360 self._is_string = False 361 else: 362 self._container = [value] 363 self._is_string = True 364 365 365 content = property(_get_content, _set_content) 366 366 367 367 def __iter__(self):