Skip to content

Commit a363c07

Browse files
authored
Merge pull request #101 from OpenDataServices/100-download-fix
Fixes download server error. Closes #100
2 parents 5b2dc01 + 8c0fd06 commit a363c07

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

prefix_finder/frontend/templates/download.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<h3> Download Full Data </h3>
1010
<br/>
1111

12-
<p> <a href="{% url 'json_download' %}">JSON: All data in its orignal format.</a></p>
12+
<p> <a href="{% url 'json_download' %}">JSON: All data in its original format.</a></p>
1313
<p> <a href="{% url 'csv_download' %}">CSV: All data in single CSV table.</a></p>
1414
<p> <a href="{% url 'xml_download' %}">XML: Subset of data in the same format as an IATI codelist.</a></p>
1515

prefix_finder/frontend/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,9 @@ def list_details(request, prefix):
493493
raise Http404('Organisation list {} does not exist'.format(prefix))
494494
return render(request, 'list.html', context={'org_list': org_list, 'branch':use_branch})
495495

496-
def _get_filename():
497-
if git_commit_ref:
498-
return git_commit_ref[:10]
496+
def _get_filename(use_branch='master'):
497+
if git_commit_ref[use_branch]:
498+
return git_commit_ref[use_branch][:10]
499499
else:
500500
return datetime.datetime.now().strftime("%Y%m%d%H%M%S")
501501

@@ -540,7 +540,7 @@ def csv_download(request):
540540

541541
response = HttpResponse(output.getvalue(), content_type='text/csv')
542542

543-
response['Content-Disposition'] = 'attachment; filename="org-id-{0}.csv"'.format(_get_filename())
543+
response['Content-Disposition'] = 'attachment; filename="org-id-{0}.csv"'.format(_get_filename(use_branch))
544544
return response
545545

546546

0 commit comments

Comments
 (0)