Message280903
Hi Stéphane,
Your patch is simple and elegant, but I'm asking myself a question about the idea to pass a class instead of an instance to the TCPServer ctor (I know that's not your choice).
If we were able to pass an instance of SimpleHTTPRequestHandler instead of its class, we'd be able to give the `directory` to the handler during the `main()`, instead of using with `chdir` and `getcwd` to pass the information in a kind of hidden/side channel.
I think that relying on `chdir` and `getcwd` to pass a parameter is not the most pretty or most testable way to do so. Also, having an `os.getcwd()` hardcoded in `SimpleHTTPRequestHandler` does not looks right (again, not your fault, it was here before…) typically for testability, but also when used in a concurrent environment, when cwd may be changed by other "coroutines".
I tried to provide a patch fixing all those condiderations, here it is. still, I can't write a patch as KISS as yours, so I'm probably in the wrong way, at least I tried. |
|
Date |
User |
Action |
Args |
2016-11-15 23:46:12 | mdk | set | recipients:
+ mdk, vstinner, matrixise |
2016-11-15 23:46:12 | mdk | set | messageid: <1479253572.34.0.244175615501.issue28707@psf.upfronthosting.co.za> |
2016-11-15 23:46:12 | mdk | link | issue28707 messages |
2016-11-15 23:46:12 | mdk | create | |
|