Fixing some Python 3.5 vs 3.7 compatibility issues

This commit is contained in:
John Donaldson 2019-04-29 20:31:16 +01:00
parent 96835d6504
commit e330990211
2 changed files with 5 additions and 2 deletions

View File

@ -16,6 +16,5 @@ COPY devel /app/
COPY example-puzzles /puzzles/ COPY example-puzzles /puzzles/
COPY theme /theme/ COPY theme /theme/
WORKDIR /moth/
ENTRYPOINT [ "python3", "/app/devel-server.py" ] ENTRYPOINT [ "python3", "/app/devel-server.py" ]
CMD [ "--bind", "0.0.0.0:8080", "--puzzles", "/puzzles", "--theme", "/theme" ] CMD [ "--bind", "0.0.0.0:8080", "--puzzles", "/puzzles", "--theme", "/theme" ]

View File

@ -43,8 +43,12 @@ class MothRequestHandler(http.server.SimpleHTTPRequestHandler):
def __init__(self, request, client_address, server): def __init__(self, request, client_address, server):
self.directory = str(server.args["theme_dir"]) self.directory = str(server.args["theme_dir"])
try:
super().__init__(request, client_address, server, directory=server.args["theme_dir"])
except TypeError:
super().__init__(request, client_address, server) super().__init__(request, client_address, server)
# Backport from Python 3.7 # Backport from Python 3.7
def translate_path(self, path): def translate_path(self, path):
# I guess we just hope that some other thread doesn't call getcwd # I guess we just hope that some other thread doesn't call getcwd