summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2023-01-03 23:20:08 (GMT)
committerGitHub <noreply@github.com>2023-01-03 23:20:08 (GMT)
commita286caa937405f7415dcc095a7ad5097c4433246 (patch)
tree96847365f9697d992ea7e0dba03e37ca9a44bbbc /Lib/http
parent64ed609c532a12b27f67a1e12e9e02f136ee3a94 (diff)
downloadcpython-a286caa937405f7415dcc095a7ad5097c4433246.zip
cpython-a286caa937405f7415dcc095a7ad5097c4433246.tar.gz
cpython-a286caa937405f7415dcc095a7ad5097c4433246.tar.bz2
gh-91219: http - use subclassing to override index_pages attribute (GH-100731)
Remove previously added parameter to `__init__`, and recommend subclassing to modify the `index_pages` attribute instead.
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/server.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py
index 221c8be..971f080 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -652,8 +652,8 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
"""
- index_pages = ["index.html", "index.htm"]
server_version = "SimpleHTTP/" + __version__
+ index_pages = ("index.html", "index.htm")
extensions_map = _encodings_map_default = {
'.gz': 'application/gzip',
'.Z': 'application/octet-stream',
@@ -661,11 +661,9 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
'.xz': 'application/x-xz',
}
- def __init__(self, *args, directory=None, index_pages=None, **kwargs):
+ def __init__(self, *args, directory=None, **kwargs):
if directory is None:
directory = os.getcwd()
- if index_pages is not None:
- self.index_pages = index_pages
self.directory = os.fspath(directory)
super().__init__(*args, **kwargs)