1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #4565 -- Changed template rendering to use iterators, rather than

creating large strings, as much as possible. This is all backwards compatible.
Thanks, Brian Harring.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5482 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2007-06-17 07:11:37 +00:00
parent 44dd91ec6d
commit bccb8897e6
21 changed files with 284 additions and 161 deletions

View File

@@ -309,7 +309,7 @@ class ServerHandler(object):
"""
if not self.result_is_file() and not self.sendfile():
for data in self.result:
self.write(data)
self.write(data, False)
self.finish_content()
self.close()
@@ -377,7 +377,7 @@ class ServerHandler(object):
else:
self._write('Status: %s\r\n' % self.status)
def write(self, data):
def write(self, data, flush=True):
"""'write()' callable as specified by PEP 333"""
assert type(data) is StringType,"write() argument must be string"
@@ -394,7 +394,8 @@ class ServerHandler(object):
# XXX check Content-Length and truncate if too many bytes written?
self._write(data)
self._flush()
if flush:
self._flush()
def sendfile(self):
"""Platform-specific file transmission
@@ -421,8 +422,6 @@ class ServerHandler(object):
if not self.headers_sent:
self.headers['Content-Length'] = "0"
self.send_headers()
else:
pass # XXX check if content-length was too short?
def close(self):
try: