mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Avoid shadowing import
This commit is contained in:
parent
af3a2d3963
commit
6ebe726670
1 changed files with 9 additions and 9 deletions
|
@ -256,22 +256,22 @@ def _handle_builtin_file_request(request: BundledFileRequest) -> Response:
|
||||||
|
|
||||||
@app.route("/<path:pathin>", methods=["GET", "POST"])
|
@app.route("/<path:pathin>", methods=["GET", "POST"])
|
||||||
def handle_request(pathin: str) -> Response:
|
def handle_request(pathin: str) -> Response:
|
||||||
request = _extract_request(pathin)
|
req = _extract_request(pathin)
|
||||||
if dev_mode:
|
if dev_mode:
|
||||||
print(f"{time.time():.3f} {flask.request.method} /{pathin}")
|
print(f"{time.time():.3f} {flask.request.method} /{pathin}")
|
||||||
|
|
||||||
if isinstance(request, NotFound):
|
if isinstance(req, NotFound):
|
||||||
print(request.message)
|
print(req.message)
|
||||||
return flask.make_response(
|
return flask.make_response(
|
||||||
f"Invalid path: {pathin}",
|
f"Invalid path: {pathin}",
|
||||||
HTTPStatus.NOT_FOUND,
|
HTTPStatus.NOT_FOUND,
|
||||||
)
|
)
|
||||||
elif callable(request):
|
elif callable(req):
|
||||||
return _handle_dynamic_request(request)
|
return _handle_dynamic_request(req)
|
||||||
elif isinstance(request, BundledFileRequest):
|
elif isinstance(req, BundledFileRequest):
|
||||||
return _handle_builtin_file_request(request)
|
return _handle_builtin_file_request(req)
|
||||||
elif isinstance(request, LocalFileRequest):
|
elif isinstance(req, LocalFileRequest):
|
||||||
return _handle_local_file_request(request)
|
return _handle_local_file_request(req)
|
||||||
else:
|
else:
|
||||||
return flask.make_response(
|
return flask.make_response(
|
||||||
f"unexpected request: {pathin}",
|
f"unexpected request: {pathin}",
|
||||||
|
|
Loading…
Reference in a new issue