#NEWLINE# def post( self , request , slug ) : #NEWLINE# #INDENT# wfile = get_object_or_404 ( WebFile , slug = slug ) #NEWLINE# form = DownloadForm ( slug . POST , wfile = wfile ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# response = HttpResponse ( mimetype = 'application/octet-stream' ) #NEWLINE# response [ 'X-Accel-Redirect' ] = wfile . attached_file . url #NEWLINE# response [ 'Content-Disposition' ] = ( 'attachment; filename=%s' % os . path . basename ( wfile . attached_file . name ) ) #NEWLINE# return response #NEWLINE# #UNINDENT# return self . render_to_response ( self . template_name , { #NEWLINE# #INDENT# 'form' : form , #NEWLINE# 'file' : wfile , #NEWLINE# #UNINDENT# } )