#NEWLINE# @ login_required #NEWLINE# def tube_stats( request , tube = None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# client = Client ( request ) #NEWLINE# #UNINDENT# except ConnectionError : #NEWLINE# #INDENT# return render_unavailable ( ) #NEWLINE# #UNINDENT# if ( request is None ) : #NEWLINE# #INDENT# stats = client . stats ( ) . items ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# stats = client . stats_tube ( tube ) . items ( ) #NEWLINE# #UNINDENT# except CommandFailed : #NEWLINE# #INDENT# raise Http404 #NEWLINE# #UNINDENT# #UNINDENT# tubes = client . tubes ( ) #NEWLINE# return render_to_response ( 'beanstalk/stats.html' , { #NEWLINE# #INDENT# 'stats' : stats , #NEWLINE# 'tubes' : tubes , #NEWLINE# 'current_tube' : tube , #NEWLINE# #UNINDENT# } , context_instance = RequestContext ( request ) )