(self, environ)
| 167 | super().__init__(*args, **kwargs) |
| 168 | |
| 169 | def __call__(self, environ): |
| 170 | # Set up middleware if needed. We couldn't do this earlier, because |
| 171 | # settings weren't available. |
| 172 | if self._middleware_chain is None: |
| 173 | self.load_middleware() |
| 174 | |
| 175 | request_started.disconnect(close_old_connections) |
| 176 | request_started.send(sender=self.__class__, environ=environ) |
| 177 | request_started.connect(close_old_connections) |
| 178 | request = WSGIRequest(environ) |
| 179 | # sneaky little hack so that we can easily get round |
| 180 | # CsrfViewMiddleware. This makes life easier, and is probably |
| 181 | # required for backwards compatibility with external tests against |
| 182 | # admin views. |
| 183 | request._dont_enforce_csrf_checks = not self.enforce_csrf_checks |
| 184 | |
| 185 | # Request goes through middleware. |
| 186 | response = self.get_response(request) |
| 187 | |
| 188 | # Simulate behaviors of most web servers. |
| 189 | conditional_content_removal(request, response) |
| 190 | |
| 191 | # Attach the originating request to the response so that it could be |
| 192 | # later retrieved. |
| 193 | response.wsgi_request = request |
| 194 | |
| 195 | # Emulate a WSGI server by calling the close method on completion. |
| 196 | if response.streaming: |
| 197 | if response.is_async: |
| 198 | response.streaming_content = aclosing_iterator_wrapper( |
| 199 | response.streaming_content, response.close |
| 200 | ) |
| 201 | else: |
| 202 | response.streaming_content = closing_iterator_wrapper( |
| 203 | response.streaming_content, response.close |
| 204 | ) |
| 205 | else: |
| 206 | request_finished.disconnect(close_old_connections) |
| 207 | response.close() # will fire request_finished |
| 208 | request_finished.connect(close_old_connections) |
| 209 | |
| 210 | return response |
| 211 | |
| 212 | |
| 213 | class AsyncClientHandler(BaseHandler): |
nothing calls this directly
no test coverage detected