Linting and comments

This commit is contained in:
zandercymatics 2023-11-28 11:24:44 -07:00
parent 4594eb7ca3
commit 14355327b2
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 18 additions and 7 deletions

View file

@ -93,7 +93,7 @@ def available(request, domain=""):
@require_http_methods(["GET"])
@login_not_required
def get_current_full(request, file_path = "migrationdata/current-full.csv"):
def get_current_full(request, file_path="migrationdata/current-full.csv"):
# Open the CSV file
file_path = "migrationdata/current-full.csv"
return serve_file(file_path)
@ -101,9 +101,10 @@ def get_current_full(request, file_path = "migrationdata/current-full.csv"):
@require_http_methods(["GET"])
@login_not_required
def get_current_federal(request, file_path = "migrationdata/current-federal.csv"):
def get_current_federal(request, file_path="migrationdata/current-federal.csv"):
return serve_file(file_path)
def serve_file(file_path):
"""Downloads a file based on a given filepath. Returns a 404 if not found."""
# TODO - #1403, grab from the S3 instance instead
@ -112,4 +113,4 @@ def serve_file(file_path):
response = FileResponse(open(file_path, "rb"))
return response
else:
return HttpResponse("File not found", status=404)
return HttpResponse("File not found", status=404)