From 0bb40a42d71873ea267aace8c92a02d66fe36dc2 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Thu, 24 Feb 2022 02:59:32 +0900 Subject: closes bpo-46736: SimpleHTTPRequestHandler now uses HTML5. (GH-31533) Co-authored-by: Oleg Iarygin --- Lib/http/server.py | 22 ++++++++++------------ .../2022-02-24-01-49-38.bpo-46736.NJcoWO.rst | 2 ++ 2 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2022-02-24-01-49-38.bpo-46736.NJcoWO.rst diff --git a/Lib/http/server.py b/Lib/http/server.py index 194a503..a6100d4 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -109,11 +109,10 @@ from http import HTTPStatus # Default error message template DEFAULT_ERROR_MESSAGE = """\ - - + + - + Error response @@ -777,14 +776,13 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): displaypath = urllib.parse.unquote(path) displaypath = html.escape(displaypath, quote=False) enc = sys.getfilesystemencoding() - title = 'Directory listing for %s' % displaypath - r.append('') - r.append('\n') - r.append('' % enc) - r.append('%s\n' % title) - r.append('\n

%s

' % title) + title = f'Directory listing for {displaypath}' + r.append('') + r.append('') + r.append('') + r.append(f'') + r.append(f'{title}\n') + r.append(f'\n

{title}

') r.append('
\n