|
1 | 1 | import json
|
| 2 | +import logging |
2 | 3 | from datetime import datetime as dt
|
3 | 4 |
|
4 | 5 | from django.core.exceptions import PermissionDenied
|
|
33 | 34 |
|
34 | 35 | content_kinds.QUIZ = "quiz"
|
35 | 36 |
|
| 37 | +logger = logging.getLogger(__name__) |
| 38 | + |
36 | 39 |
|
37 | 40 | @method_decorator(cache_no_user_data, name="dispatch")
|
38 | 41 | class FacilityManagementView(TemplateView):
|
@@ -127,6 +130,7 @@ def exported_csv_info(request, facility_id):
|
127 | 130 |
|
128 | 131 |
|
129 | 132 | def download_csv_file(request, csv_type, facility_id):
|
| 133 | + logger.info("Downloading CSV file for facility {}".format(facility_id)) |
130 | 134 |
|
131 | 135 | facility = _get_facility_check_permissions(request, facility_id)
|
132 | 136 |
|
@@ -201,6 +205,8 @@ def download_csv_file(request, csv_type, facility_id):
|
201 | 205 | else:
|
202 | 206 | filename = None
|
203 | 207 |
|
| 208 | + logger.info("Downloading CSV file: {}".format(filename)) |
| 209 | + logger.info("{} exists: {}".format(filename, default_storage.exists(filename))) |
204 | 210 | # if the file does not exist on disk, return a 404
|
205 | 211 | if filename is None or not default_storage.exists(filename):
|
206 | 212 | raise Http404("There is no csv export file for {} available".format(csv_type))
|
@@ -228,4 +234,5 @@ def download_csv_file(request, csv_type, facility_id):
|
228 | 234 | # set the content-length to the file size
|
229 | 235 | response.headers["Content-Length"] = default_storage.size(filename)
|
230 | 236 |
|
| 237 | + logger.info("Downloaded CSV file and responding") |
231 | 238 | return response
|
0 commit comments