#NEWLINE# def download( self , filename , action = 'download' , x_filename = '' , x_sendfile = None , real_filename = '' ) : #NEWLINE# #INDENT# '\n        action will be "download", "inline"\n        and if the request.GET has \'action\', then the action will be replaced by it.\n        ' #NEWLINE# from uliweb import request #NEWLINE# from uliweb.utils.common import safe_str #NEWLINE# from uliweb.utils.filedown import filedown #NEWLINE# s = settings . GLOBAL #NEWLINE# action = request . GET . get ( 'action' , action ) #NEWLINE# if ( not real_filename ) : #NEWLINE# #INDENT# real_filename = self . get_filename ( filename , True , convert = False ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# real_filename = files . encode_filename ( real_filename , to_encoding = s . FILESYSTEM_ENCODING ) #NEWLINE# #UNINDENT# if ( not x_filename ) : #NEWLINE# #INDENT# x_filename = safe_str ( filename , s . FILESYSTEM_ENCODING ) #NEWLINE# #UNINDENT# if self . x_file_prefix : #NEWLINE# #INDENT# x_filename = os . path . normpath ( os . path . join ( self . x_file_prefix , x_filename ) ) . replace ( '\\' , '/' ) #NEWLINE# #UNINDENT# xsend_flag = ( bool ( self . x_sendfile ) if ( x_sendfile is None ) else x_sendfile ) #NEWLINE# return filedown ( request . environ , filename , action = action , x_sendfile = xsend_flag , x_header_name = self . x_header_name , x_filename = x_filename , real_filename = real_filename )