handle cases where USE_X_ACCEL_REDIRECT is not defined
This commit is contained in:
		
							parent
							
								
									63d07f8db3
								
							
						
					
					
						commit
						07e98036b7
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
					@ -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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue