MCPcopy Create free account
hub / github.com/django/daphne / basic_error

Method basic_error

daphne/http_protocol.py:352–374  ·  view source on GitHub ↗

Responds with a server-level error page (very basic)

(self, status, status_text, body)

Source from the content-addressed store, hash-verified

350 return time.time() - self.request_start
351
352 def basic_error(self, status, status_text, body):
353 """
354 Responds with a server-level error page (very basic)
355 """
356 self.handle_reply(
357 {
358 "type": "http.response.start",
359 "status": status,
360 "headers": [(b"Content-Type", b"text/html; charset=utf-8")],
361 }
362 )
363 self.handle_reply(
364 {
365 "type": "http.response.body",
366 "body": (
367 self.error_template
368 % {
369 "title": str(status) + " " + status_text.decode("ascii"),
370 "body": body,
371 }
372 ).encode("utf8"),
373 }
374 )
375
376 def __hash__(self):
377 return hash(id(self))

Callers 4

processMethod · 0.95
handle_exceptionMethod · 0.95
check_timeoutsMethod · 0.95
handle_replyMethod · 0.80

Calls 2

handle_replyMethod · 0.95
encodeMethod · 0.80

Tested by

no test coverage detected