From: Yorik Hansen Date: Tue, 3 Sep 2024 06:32:11 +0000 (+0200) Subject: gh-123430: Add dark mode support to pages generated by http.server (#123475) X-Git-Tag: v3.14.0a1~605 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9684f40b9f51816fd326f1b4957ea5fb5b5922c8;p=thirdparty%2FPython%2Fcpython.git gh-123430: Add dark mode support to pages generated by http.server (#123475) Co-authored-by: Peter Bierma Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Victor Stinner --- diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 4817c5258052..233d7ce0399c 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -151,6 +151,14 @@ Added support for converting any objects that have the (Contributed by Serhiy Storchaka in :gh:`82017`.) +http +---- + +Directory lists and error pages generated by the :mod:`http.server` +module allow the browser to apply its default dark mode. +(Contributed by Yorik Hansen in :gh:`123430`.) + + json ---- diff --git a/Lib/http/server.py b/Lib/http/server.py index 2d010649e56b..a6f7aecc7876 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -114,6 +114,11 @@ DEFAULT_ERROR_MESSAGE = """\ + Error response @@ -804,6 +809,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): r.append('') r.append('') r.append(f'') + r.append('') r.append(f'{title}\n') r.append(f'\n

{title}

') r.append('
\n
    ') diff --git a/Misc/NEWS.d/next/Library/2024-08-29-14-51-36.gh-issue-123430.M7wXl9.rst b/Misc/NEWS.d/next/Library/2024-08-29-14-51-36.gh-issue-123430.M7wXl9.rst new file mode 100644 index 000000000000..0afdad7917fa --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-08-29-14-51-36.gh-issue-123430.M7wXl9.rst @@ -0,0 +1 @@ +Pages generated by the :mod:`http.server` module allow the browser to apply its default dark mode.