MCPcopy
hub / github.com/cherrypy/cherrypy / set_response

Method set_response

cherrypy/_cperror.py:383–408  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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)

Callers 3

respondMethod · 0.45
handle_errorMethod · 0.45
gzipFunction · 0.45

Calls 5

get_error_pageMethod · 0.95
clean_headersFunction · 0.85
format_excFunction · 0.85
_be_ie_unfriendlyFunction · 0.85
popMethod · 0.80

Tested by

no test coverage detected