(sock, status_int, reason, mesg)
| 352 | |
| 353 | |
| 354 | def write_error(sock, status_int, reason, mesg): |
| 355 | html_error = textwrap.dedent("""\ |
| 356 | <html> |
| 357 | <head> |
| 358 | <title>%(reason)s</title> |
| 359 | </head> |
| 360 | <body> |
| 361 | <h1><p>%(reason)s</p></h1> |
| 362 | %(mesg)s |
| 363 | </body> |
| 364 | </html> |
| 365 | """) % {"reason": reason, "mesg": html.escape(mesg)} |
| 366 | |
| 367 | http = textwrap.dedent("""\ |
| 368 | HTTP/1.1 %s %s\r |
| 369 | Connection: close\r |
| 370 | Content-Type: text/html\r |
| 371 | Content-Length: %d\r |
| 372 | \r |
| 373 | %s""") % (str(status_int), reason, len(html_error), html_error) |
| 374 | write_nonblock(sock, http.encode('latin1')) |
| 375 | |
| 376 | |
| 377 | def _called_with_wrong_args(f): |
nothing calls this directly
no test coverage detected