#NEWLINE# def send_file( path , filename = None , content_type = None ) : #NEWLINE# #INDENT# if ( filename is None ) : #NEWLINE# #INDENT# filename = os . path . basename ( path ) #NEWLINE# #UNINDENT# if ( content_type is None ) : #NEWLINE# #INDENT# ( content_type , encoding ) = mimetypes . guess_type ( filename ) #NEWLINE# #UNINDENT# response = HttpResponse ( content_type = content_type ) #NEWLINE# response [ 'Content-Disposition' ] = ( 'attachment; filename=%s' % filename ) #NEWLINE# response . write ( open ( path , 'rb' ) . read ( ) ) #NEWLINE# return response