handle cases where USE_X_ACCEL_REDIRECT is not defined

This commit is contained in:
Luke Hatcher 2012-07-18 19:21:50 -04:00
parent 63d07f8db3
commit 07e98036b7

View file

@ -302,7 +302,7 @@ def document_create(request, proposal_pk):
@login_required @login_required
def document_download(request, pk, *args): def document_download(request, pk, *args):
document = get_object_or_404(SupportingDocument, pk=pk) document = get_object_or_404(SupportingDocument, pk=pk)
if settings.USE_X_ACCEL_REDIRECT: if getattr(settings, "USE_X_ACCEL_REDIRECT", False):
response = HttpResponse() response = HttpResponse()
response["X-Accel-Redirect"] = document.file.url response["X-Accel-Redirect"] = document.file.url
# delete content-type to allow Gondor to determine the filetype and # delete content-type to allow Gondor to determine the filetype and