#NEWLINE# def upload_object( self , file_path , container , object_name , extra = None , verify_hash = True ) : #NEWLINE# #INDENT# upload_func = self . _upload_file #NEWLINE# upload_func_kwargs = { #NEWLINE# #INDENT# 'file_path' : file_path , #NEWLINE# #UNINDENT# } #NEWLINE# method = 'PUT' #NEWLINE# extra = ( extra or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# object_name_cleaned = self . _clean_object_name ( object_name ) #NEWLINE# request_path = ( ( self . _namespace_path ( container . name ) + '/' ) + object_name_cleaned ) #NEWLINE# content_type = extra . get ( 'content_type' , None ) #NEWLINE# try : #NEWLINE# #INDENT# self . connection . request ( ( request_path + '?metadata/system' ) ) #NEWLINE# #UNINDENT# except AtmosError : #NEWLINE# #INDENT# e = sys . exc_info ( ) [ 1 ] #NEWLINE# if ( e . code != 1003 ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# method = 'POST' #NEWLINE# #UNINDENT# result_dict = self . _upload_object ( object_name = object_name , content_type = content_type , upload_func = upload_func , upload_func_kwargs = upload_func_kwargs , request_path = request_path , request_method = method , headers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , file_path = file_path ) #NEWLINE# bytes_transferred = result_dict [ 'bytes_transferred' ] #NEWLINE# if ( extra is None ) : #NEWLINE# #INDENT# meta_data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# meta_data = extra . get ( 'meta_data' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# meta_data [ 'md5' ] = result_dict [ 'data_hash' ] #NEWLINE# user_meta = ', ' . join ( [ ( ( k + '=' ) + str ( v ) ) for ( k , v ) in list ( meta_data . items ( ) ) ] ) #NEWLINE# self . connection . request ( ( request_path + '?metadata/user' ) , method = 'POST' , headers = { #NEWLINE# #INDENT# 'x-emc-meta' : user_meta , #NEWLINE# #UNINDENT# } ) #NEWLINE# result = self . connection . request ( ( request_path + '?metadata/system' ) ) #NEWLINE# meta = self . _emc_meta ( result ) #NEWLINE# del meta_data [ 'md5' ] #NEWLINE# extra = { #NEWLINE# #INDENT# 'object_id' : meta [ 'objectid' ] , #NEWLINE# 'meta_data' : meta_data , #NEWLINE# #UNINDENT# } #NEWLINE# return Object ( object_name , bytes_transferred , result_dict [ 'data_hash' ] , extra , meta_data , container , self )