MCPcopy
hub / github.com/django/django / __call__

Method __call__

django/core/handlers/wsgi.py:120–144  ·  view source on GitHub ↗
(self, environ, start_response)

Source from the content-addressed store, hash-verified

118 self.load_middleware()
119
120 def __call__(self, environ, start_response):
121 set_script_prefix(get_script_name(environ))
122 signals.request_started.send(sender=self.__class__, environ=environ)
123 request = self.request_class(environ)
124 response = self.get_response(request)
125
126 response._handler_class = self.__class__
127
128 status = "%d %s" % (response.status_code, response.reason_phrase)
129 response_headers = [
130 *response.items(),
131 *(("Set-Cookie", c.OutputString()) for c in response.cookies.values()),
132 ]
133 start_response(status, response_headers)
134 if getattr(response, "file_to_stream", None) is not None and environ.get(
135 "wsgi.file_wrapper"
136 ):
137 # If `wsgi.file_wrapper` is used the WSGI server does not call
138 # .close on the response, but on the file wrapper. Patch it to use
139 # response.close instead which takes care of closing all files.
140 response.file_to_stream.close = response.close
141 response = environ["wsgi.file_wrapper"](
142 response.file_to_stream, response.block_size
143 )
144 return response
145
146
147def get_path_info(environ):

Callers

nothing calls this directly

Calls 7

set_script_prefixFunction · 0.90
get_script_nameFunction · 0.85
sendMethod · 0.45
get_responseMethod · 0.45
itemsMethod · 0.45
valuesMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected