Modify cherrypy.response status, headers, and body to represent self. CherryPy uses this internally, but you can also use it to create an HTTPError object and set its output without *raising* the exception.
(self)
| 381 | CherryPyException.__init__(self, status, message) |
| 382 | |
| 383 | def set_response(self): |
| 384 | """Modify cherrypy.response status, headers, and body to represent |
| 385 | self. |
| 386 | |
| 387 | CherryPy uses this internally, but you can also use it to create |
| 388 | an HTTPError object and set its output without *raising* the |
| 389 | exception. |
| 390 | """ |
| 391 | response = cherrypy.serving.response |
| 392 | |
| 393 | clean_headers(self.code) |
| 394 | |
| 395 | # In all cases, finalize will be called after this method, |
| 396 | # so don't bother cleaning up response values here. |
| 397 | response.status = self.status |
| 398 | tb = None |
| 399 | if cherrypy.serving.request.show_tracebacks: |
| 400 | tb = format_exc() |
| 401 | |
| 402 | response.headers.pop('Content-Length', None) |
| 403 | |
| 404 | content = self.get_error_page(self.status, traceback=tb, |
| 405 | message=self._message) |
| 406 | response.body = content |
| 407 | |
| 408 | _be_ie_unfriendly(self.code) |
| 409 | |
| 410 | def get_error_page(self, *args, **kwargs): |
| 411 | return get_error_page(*args, **kwargs) |
no test coverage detected