#NEWLINE# def swift_get_container( request , container_name , with_data = True ) : #NEWLINE# #INDENT# if with_data : #NEWLINE# #INDENT# ( headers , data ) = swift_api ( request ) . get_object ( container_name , '' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# data = None #NEWLINE# headers = swift_api ( request ) . head_container ( container_name ) #NEWLINE# #UNINDENT# timestamp = None #NEWLINE# is_public = False #NEWLINE# public_url = None #NEWLINE# try : #NEWLINE# #INDENT# is_public = ( GLOBAL_READ_ACL in headers . get ( 'x-container-read' , '' ) ) #NEWLINE# if is_public : #NEWLINE# #INDENT# swift_endpoint = base . url_for ( request , 'object-store' , endpoint_type = 'publicURL' ) #NEWLINE# parameters = urlparse . quote ( container_name . encode ( 'utf8' ) ) #NEWLINE# public_url = ( ( request + '/' ) + parameters ) #NEWLINE# #UNINDENT# ts_float = float ( headers . get ( 'x-timestamp' ) ) #NEWLINE# timestamp = timeutils . iso8601_from_timestamp ( ts_float ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# container_info = { #NEWLINE# #INDENT# 'name' : container_name , #NEWLINE# 'container_object_count' : headers . get ( 'x-container-object-count' ) , #NEWLINE# 'container_bytes_used' : headers . get ( 'x-container-bytes-used' ) , #NEWLINE# 'timestamp' : timestamp , #NEWLINE# 'data' : data , #NEWLINE# 'is_public' : is_public , #NEWLINE# 'public_url' : public_url , #NEWLINE# #UNINDENT# } #NEWLINE# return Container ( container_info )