#NEWLINE# @ staticmethod #NEWLINE# def _create_dir_marker_job( conn , container , obj , options , path = None ) : #NEWLINE# #INDENT# res = { #NEWLINE# #INDENT# 'action' : 'create_dir_marker' , #NEWLINE# 'container' : container , #NEWLINE# 'object' : obj , #NEWLINE# 'path' : path , #NEWLINE# #UNINDENT# } #NEWLINE# results_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( obj . startswith ( './' ) or obj . startswith ( '.\\' ) ) : #NEWLINE# #INDENT# obj = obj [ 2 : ] #NEWLINE# #UNINDENT# if obj . startswith ( '/' ) : #NEWLINE# #INDENT# obj = obj [ 1 : ] #NEWLINE# #UNINDENT# if ( path is not None ) : #NEWLINE# #INDENT# put_headers = { #NEWLINE# #INDENT# 'x-object-meta-mtime' : ( '%f' % getmtime ( path ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# put_headers = { #NEWLINE# #INDENT# 'x-object-meta-mtime' : ( '%f' % round ( time ( ) ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# res [ 'headers' ] = put_headers #NEWLINE# if options [ 'changed' ] : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# headers = conn . head_object ( container , obj ) #NEWLINE# ct = headers . get ( 'content-type' ) #NEWLINE# cl = int ( headers . get ( 'content-length' ) ) #NEWLINE# et = headers . get ( 'etag' ) #NEWLINE# mt = headers . get ( 'x-object-meta-mtime' ) #NEWLINE# if ( ( ct . split ( ';' , 1 ) [ 0 ] == 'text/directory' ) and ( cl == 0 ) and ( et == EMPTY_ETAG ) and ( mt == put_headers [ 'x-object-meta-mtime' ] ) ) : #NEWLINE# #INDENT# res [ 'success' ] = True #NEWLINE# return res #NEWLINE# #UNINDENT# #UNINDENT# except ClientException as err : #NEWLINE# #INDENT# if ( err . http_status != 404 ) : #NEWLINE# #INDENT# ( traceback , err_time ) = report_traceback ( ) #NEWLINE# logger . exception ( err ) #NEWLINE# res . update ( { #NEWLINE# #INDENT# 'success' : False , #NEWLINE# 'error' : err , #NEWLINE# 'traceback' : traceback , #NEWLINE# 'error_timestamp' : err_time , #NEWLINE# #UNINDENT# } ) #NEWLINE# return res #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# conn . put_object ( container , obj , '' , content_length = 0 , content_type = 'text/directory' , headers = put_headers , response_dict = results_dict ) #NEWLINE# res . update ( { #NEWLINE# #INDENT# 'success' : True , #NEWLINE# 'response_dict' : results_dict , #NEWLINE# #UNINDENT# } ) #NEWLINE# return res #NEWLINE# #UNINDENT# except Exception as err : #NEWLINE# #INDENT# ( traceback , err_time ) = report_traceback ( ) #NEWLINE# logger . exception ( err ) #NEWLINE# res . update ( { #NEWLINE# #INDENT# 'success' : False , #NEWLINE# 'error' : err , #NEWLINE# 'traceback' : traceback , #NEWLINE# 'error_timestamp' : err_time , #NEWLINE# 'response_dict' : results_dict , #NEWLINE# #UNINDENT# } ) #NEWLINE# return res