parameters: (app, codes)
return_statement: return RecursiveMiddleware(
          StatusBasedForward(
              app,
              error_codes_mapper,
              codes=codes,
          )
      )
docstring: Intercepts a response with a particular status code and returns the
      content from a specified URL instead.
  
      The arguments are:
  
      ``app``
          The WSGI application or middleware chain.
  
      ``codes``
          A dictionary of integer status codes and the URL to be displayed
          if the response uses that code.
  
      For example, you might want to create a static file to display a
      "File Not Found" message at the URL ``/error404.html`` and then use
      ``forward`` middleware to catch all 404 status codes and display the page
      you created. In this example ``app`` is your exisiting WSGI
      applicaiton::
  
          from paste.errordocument import forward
          app = forward(app, codes={404:'/error404.html'})
docstring_summary: Intercepts a response with a particular status code and returns the
      content from a specified URL instead.
docstring_tokens: Intercepts a response with a particular status code and returns the content from a specified URL instead .
function: def forward(app, codes):
      """
      Intercepts a response with a particular status code and returns the
      content from a specified URL instead.
  
      The arguments are:
  
      ``app``
          The WSGI application or middleware chain.
  
      ``codes``
          A dictionary of integer status codes and the URL to be displayed
          if the response uses that code.
  
      For example, you might want to create a static file to display a
      "File Not Found" message at the URL ``/error404.html`` and then use
      ``forward`` middleware to catch all 404 status codes and display the page
      you created. In this example ``app`` is your exisiting WSGI
      applicaiton::
  
          from paste.errordocument import forward
          app = forward(app, codes={404:'/error404.html'})
  
      """
      for code in codes:
          if not isinstance(code, int):
              raise TypeError('All status codes should be type int. '
                  '%s is not valid'%repr(code))
  
      def error_codes_mapper(code, message, environ, global_conf, codes):
          if code in codes:
              return codes[code]
          else:
              return None
  
      #return _StatusBasedRedirect(app, error_codes_mapper, codes=codes)
      return RecursiveMiddleware(
          StatusBasedForward(
              app,
              error_codes_mapper,
              codes=codes,
          )
      )
function_tokens: def forward ( app , codes ) : for code in codes : if not isinstance ( code , int ) : raise TypeError ( 'All status codes should be type int. ' '%s is not valid' % repr ( code ) ) def error_codes_mapper ( code , message , environ , global_conf , codes ) : if code in codes : return codes [ code ] else : return None #return _StatusBasedRedirect(app, error_codes_mapper, codes=codes) return RecursiveMiddleware ( StatusBasedForward ( app , error_codes_mapper , codes = codes , ) )