#NEWLINE# def put_file( self , file_saver , abs_filepath , token , upload_size ) : #NEWLINE# #INDENT# '\n        file_saver is an object with the save() method without parameters\n        ' #NEWLINE# try : #NEWLINE# #INDENT# ( encoded_path , filesize , user ) = self . updown_auth_manager . get_resource_info ( token ) #NEWLINE# if ( upload_size != filesize ) : #NEWLINE# #INDENT# logger . debug ( ( 'Invalid size file!!: %s: %s' % ( file_saver , abs_filepath ) ) ) #NEWLINE# raise RequestErrorException ( 'Bad file size' ) #NEWLINE# #UNINDENT# abs_encoded_path = os . path . abspath ( os . path . join ( self . base_store_folder , encoded_path ) ) #NEWLINE# if ( not self . _valid_path ( abs_filepath , abs_encoded_path ) ) : #NEWLINE# #INDENT# raise NotFoundException ( 'File not found' ) #NEWLINE# #UNINDENT# logger . debug ( ( 'Put file: %s: %s' % ( user , abs_filepath ) ) ) #NEWLINE# mkdir ( os . path . dirname ( abs_filepath ) ) #NEWLINE# if os . path . exists ( abs_filepath ) : #NEWLINE# #INDENT# os . remove ( abs_filepath ) #NEWLINE# #UNINDENT# file_saver . save ( os . path . dirname ( abs_filepath ) ) #NEWLINE# #UNINDENT# except ( jwt . ExpiredSignature , jwt . DecodeError , AttributeError ) : #NEWLINE# #INDENT# return NotFoundException ( 'File not found' )