#NEWLINE# def toggle_public( request , container ) : #NEWLINE# #INDENT# " Sets/unsets '.r:*,.rlistings' container read ACL " #NEWLINE# storage_url = request . session . get ( 'storage_url' , '' ) #NEWLINE# auth_token = request . session . get ( 'auth_token' , '' ) #NEWLINE# try : #NEWLINE# #INDENT# meta = client . head_container ( storage_url , auth_token , container ) #NEWLINE# #UNINDENT# except client . ClientException : #NEWLINE# #INDENT# messages . add_message ( request , messages . ERROR , _ ( 'Access denied.' ) ) #NEWLINE# return redirect ( containerview ) #NEWLINE# #UNINDENT# read_acl = meta . get ( 'x-container-read' , '' ) #NEWLINE# if ( '.rlistings' and ( '.r:*' in read_acl ) ) : #NEWLINE# #INDENT# read_acl = read_acl . replace ( '.r:*' , '' ) #NEWLINE# read_acl = read_acl . replace ( '.rlistings' , '' ) #NEWLINE# read_acl = read_acl . replace ( ',,' , ',' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# read_acl += '.r:*,.rlistings' #NEWLINE# #UNINDENT# headers = { #NEWLINE# #INDENT# 'X-Container-Read' : read_acl , #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# client . post_container ( storage_url , auth_token , container , headers ) #NEWLINE# #UNINDENT# except client . ClientException : #NEWLINE# #INDENT# messages . add_message ( request , messages . ERROR , _ ( 'Access denied.' ) ) #NEWLINE# #UNINDENT# return redirect ( objectview , container = container )