#NEWLINE# @ settings_view_decorator #NEWLINE# def browser( request , path = '' , template = 'cloud_browser/browser.html' ) : #NEWLINE# #INDENT# 'View files in a file path.\n\n    :param request: The request.\n    :param path: Path to resource, including container as first part of path.\n    :param template: Template to render.\n    ' #NEWLINE# from itertools import ifilter , islice #NEWLINE# ( container_path , object_path ) = path_parts ( path ) #NEWLINE# incoming = ( request . POST or request . GET or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# marker = incoming . get ( 'marker' , None ) #NEWLINE# marker_part = incoming . get ( 'marker_part' , None ) #NEWLINE# if marker_part : #NEWLINE# #INDENT# marker = path_join ( object_path , marker_part ) #NEWLINE# #UNINDENT# limit_default = settings . CLOUD_BROWSER_DEFAULT_LIST_LIMIT #NEWLINE# limit_test = ( lambda x : ( ( x > 0 ) and ( ( MAX_LIMIT is None ) or ( x <= ( MAX_LIMIT - 1 ) ) ) ) ) #NEWLINE# limit = get_int ( incoming . get ( 'limit' , limit_default ) , limit_default , limit_test ) #NEWLINE# conn = get_connection ( ) #NEWLINE# containers = conn . get_containers ( ) #NEWLINE# marker_part = None #NEWLINE# container = None #NEWLINE# objects = None #NEWLINE# if ( container_path != '' ) : #NEWLINE# #INDENT# cont_eq = ( lambda c : ( c . name == container_path ) ) #NEWLINE# cont_list = list ( islice ( ifilter ( cont_eq , containers ) , 1 ) ) #NEWLINE# if ( not cont_list ) : #NEWLINE# #INDENT# raise Http404 ( ( 'No container at: %s' % container_path ) ) #NEWLINE# #UNINDENT# container = cont_list [ 0 ] #NEWLINE# objects = container . get_objects ( object_path , marker , ( limit + 1 ) ) #NEWLINE# marker = None #NEWLINE# if ( len ( objects ) == ( limit + 1 ) ) : #NEWLINE# #INDENT# objects = objects [ : limit ] #NEWLINE# marker = objects [ ( - 1 ) ] . name #NEWLINE# marker_part = relpath ( marker , object_path ) #NEWLINE# #UNINDENT# #UNINDENT# return render_to_response ( template , { #NEWLINE# #INDENT# 'path' : path , #NEWLINE# 'marker' : marker , #NEWLINE# 'marker_part' : marker_part , #NEWLINE# 'limit' : limit , #NEWLINE# 'breadcrumbs' : _breadcrumbs ( path ) , #NEWLINE# 'container_path' : container_path , #NEWLINE# 'containers' : containers , #NEWLINE# 'container' : container , #NEWLINE# 'object_path' : object_path , #NEWLINE# 'objects' : objects , #NEWLINE# #UNINDENT# } , context_instance = RequestContext ( request ) )