#NEWLINE# def after( self , state ) : #NEWLINE# #INDENT# responses = { #NEWLINE# #INDENT# 'controller' : ( lambda self , state : self . get_controller ( state ) ) , #NEWLINE# 'method' : ( lambda self , state : state . request . method ) , #NEWLINE# 'path' : ( lambda self , state : state . request . path ) , #NEWLINE# 'params' : ( lambda self , state : [ ( p [ 0 ] . encode ( 'utf-8' ) , p [ 1 ] . encode ( 'utf-8' ) ) for p in state . request . params . items ( ) ] ) , #NEWLINE# 'status' : ( lambda self , state : state . response . status ) , #NEWLINE# 'hooks' : ( lambda self , state : self . format_hooks ( state . app . hooks ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# is_available = [ i for i in self . items if ( ( i in self . available ) or hasattr ( state . request , i ) ) ] #NEWLINE# terminal = [ ] #NEWLINE# headers = [ ] #NEWLINE# will_skip = [ i for i in self . blacklist if state . request . path . startswith ( i ) ] #NEWLINE# if will_skip : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# for request_info in is_available : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# value = responses . get ( request_info ) #NEWLINE# if ( not value ) : #NEWLINE# #INDENT# value = getattr ( state . request , request_info ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value = value ( self , state ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# value = e #NEWLINE# #UNINDENT# terminal . append ( ( '%-12s - %s\n' % ( request_info , value ) ) ) #NEWLINE# headers . append ( ( request_info , value ) ) #NEWLINE# #UNINDENT# if self . terminal : #NEWLINE# #INDENT# self . writer . write ( '' . join ( terminal ) ) #NEWLINE# self . writer . write ( '\n\n' ) #NEWLINE# #UNINDENT# if self . headers : #NEWLINE# #INDENT# for h in headers : #NEWLINE# #INDENT# key = str ( h [ 0 ] ) #NEWLINE# value = str ( h [ 1 ] ) #NEWLINE# name = ( 'X-Pecan-%s' % key ) #NEWLINE# state . response . headers [ name ] = value