#NEWLINE# def __call__( self , environ , start_response ) : #NEWLINE# #INDENT# def replacement_start_response( status , headers , exc_info = None ) : #NEWLINE# #INDENT# '\n            Overrides the default response if the status is defined in the\n            Pecan app error map configuration.\n            ' #NEWLINE# try : #NEWLINE# #INDENT# status_code = int ( status . split ( ' ' ) [ 0 ] ) #NEWLINE# #UNINDENT# except ( ValueError , TypeError ) : #NEWLINE# #INDENT# raise Exception ( ( 'ErrorDocumentMiddleware received an invalid status %s' % status ) ) #NEWLINE# #UNINDENT# if ( status_code in self . error_map ) : #NEWLINE# #INDENT# def factory( app ) : #NEWLINE# #INDENT# return StatusPersist ( app , status , self . error_map [ status_code ] ) #NEWLINE# #UNINDENT# raise ForwardRequestException ( factory = factory ) #NEWLINE# #UNINDENT# return start_response ( status , headers , exc_info ) #NEWLINE# #UNINDENT# app_iter = self . app ( environ , start_response ) #NEWLINE# return app_iter