MCPcopy Index your code
hub / github.com/python/cpython / finish_response

Method finish_response

Lib/wsgiref/handlers.py:174–197  ·  view source on GitHub ↗

Send any iterable data, then close self and the iterable Subclasses intended for use in asynchronous servers will want to redefine this method, such that it sets up callbacks in the event loop to iterate over the data, and to call 'self.close()' once the response is

(self)

Source from the content-addressed store, hash-verified

172
173
174 def finish_response(self):
175 """Send any iterable data, then close self and the iterable
176
177 Subclasses intended for use in asynchronous servers will
178 want to redefine this method, such that it sets up callbacks
179 in the event loop to iterate over the data, and to call
180 'self.close()' once the response is finished.
181 """
182 try:
183 if not self.result_is_file() or not self.sendfile():
184 for data in self.result:
185 self.write(data)
186 self.finish_content()
187 except:
188 # Call close() on the iterable returned by the WSGI application
189 # in case of an exception.
190 if hasattr(self.result, 'close'):
191 self.result.close()
192 raise
193 else:
194 # We only call close() when no exception is raised, because it
195 # will set status, result, headers, and environ fields to None.
196 # See bpo-29183 for more details.
197 self.close()
198
199
200 def get_scheme(self):

Callers 2

runMethod · 0.95
handle_errorMethod · 0.95

Calls 5

result_is_fileMethod · 0.95
sendfileMethod · 0.95
writeMethod · 0.95
finish_contentMethod · 0.95
closeMethod · 0.95

Tested by

no test coverage detected