Issue #16220: wsgiref now always calls close() on an iterable response.

Patch by Brent Tubbs.
This commit is contained in:
Antoine Pitrou 2012-10-21 14:09:05 +02:00
parent c859bd2b28
commit e97a24d06a
4 changed files with 30 additions and 36 deletions

View file

@ -122,11 +122,13 @@ class BaseHandler:
in the event loop to iterate over the data, and to call
'self.close()' once the response is finished.
"""
if not self.result_is_file() or not self.sendfile():
for data in self.result:
self.write(data)
self.finish_content()
self.close()
try:
if not self.result_is_file() or not self.sendfile():
for data in self.result:
self.write(data)
self.finish_content()
finally:
self.close()
def get_scheme(self):