Skip to content

Commit

Permalink
eliminated custom translate_path
Browse files Browse the repository at this point in the history
  • Loading branch information
Temidayo32 committed Oct 22, 2024
1 parent 337c5d8 commit 63298bf
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions tests/webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,9 @@
class MyRequestHandler(SimpleHTTPRequestHandler):
"""Custom HTTP request handler that serves files from another directory."""

def translate_path(self, path):
"""Change working directory and translate path.
Returns:
str: Path to web server resource
"""
path = SimpleHTTPRequestHandler.translate_path(self, path)
rel_path = Path(path).relative_to(Path.cwd())
return str(Path(__file__).parent / "web" / rel_path)
def __init__(self, *args, **kwargs):
self.directory = str(Path(__file__).parent / "web")
super().__init__(*args, directory=self.directory, **kwargs)


class WebServer(object):
Expand Down

0 comments on commit 63298bf

Please sign in to comment.