#NEWLINE# def code_browser( request , slug , path ) : #NEWLINE# #INDENT# repo = get_object_or_404 ( CodeRepository , slug = slug ) #NEWLINE# rev = ( request . GET . get ( 'rev' ) or None ) #NEWLINE# context = { #NEWLINE# #INDENT# 'repo' : repo , #NEWLINE# 'path' : path , #NEWLINE# #UNINDENT# } #NEWLINE# file_contents = repo . get_file_contents ( path , rev ) #NEWLINE# if ( file_contents is None ) : #NEWLINE# #INDENT# folder_contents = repo . get_folder_contents ( path , rev ) #NEWLINE# if ( folder_contents is None ) : #NEWLINE# #INDENT# raise Http404 #NEWLINE# #UNINDENT# ( context [ 'files' ] , context [ 'folders' ] ) = folder_contents #NEWLINE# context [ 'files' ] = [ ( os . path . join ( path , o ) , o ) for o in context [ 'files' ] ] #NEWLINE# context [ 'folders' ] = [ ( os . path . join ( path , o ) , o ) for o in context [ 'folders' ] ] #NEWLINE# return render_to_response ( [ ( 'django_vcs/%s/folder_contents.html' % repo . name ) , 'django_vcs/folder_contents.html' ] , context , context_instance = RequestContext ( request ) ) #NEWLINE# #UNINDENT# context [ 'file' ] = file_contents #NEWLINE# return render_to_response ( [ ( 'django_vcs/%s/file_contents.html' % repo . name ) , 'django_vcs/file_contents.html' ] , context , context_instance = RequestContext ( request ) )