def dispatch(self, req):
        """
        Called by the Routes middleware to dispatch the request to the
        appropriate controller.  If a webob exception is raised, it is
        returned; if some other exception is raised, the webob
        `HTTPInternalServerError` exception is raised.  Otherwise, the
        return value of the controller is returned.
        """

        # Grab the request parameters
        params = req.environ['wsgiorg.routing_args'][1]

        # What controller is authoritative?
        controller = params.pop('controller')

        # Determine its name
        cont_class = controller.__class__
        cont_name = "%s:%s" % (cont_class.__module__, cont_class.__name__)

        # Determine the origin of the request
        origin = req.remote_addr if req.remote_addr else '[local]'
        if req.remote_user:
            origin = '%s (%s)' % (origin, req.remote_user)

        # Log that we're processing the request
        LOG.info("%s %s %s (controller %r)" %
                 (origin, req.method, req.url, cont_name))

        # Call into that controller
        try:
            return controller(req, params)
        except webob.exc.HTTPException as e:
            # Return the HTTP exception directly
            return e
        except exceptions.AppathyResponse as e:
            # Return the webob.Response directly
            return e.response
        except Exception as e:
            # Log the controller exception
            LOG.exception("Exception occurred in controller %r" % cont_name)

            # These exceptions result in a 500.  Note we're
            # intentionally not including the exception message, since
            # it could contain sensitive data.
            return webob.exc.HTTPInternalServerError()
def dispatch ( self , req ) : params = req . environ [ 'wsgiorg.routing_args' ] [ 1 ] controller = params . pop ( 'controller' ) cont_class = controller . __class__ cont_name = "%s:%s" % ( cont_class . __module__ , cont_class . __name__ ) origin = req . remote_addr if req . remote_addr else '[local]' if req . remote_user : origin = '%s (%s)' % ( origin , req . remote_user ) LOG . info ( "%s %s %s (controller %r)" % ( origin , req . method , req . url , cont_name ) ) try : return controller ( req , params ) except webob . exc . HTTPException as e : return e except exceptions . AppathyResponse as e : return e . response except Exception as e : LOG . exception ( "Exception occurred in controller %r" % cont_name ) return webob . exc . HTTPInternalServerError ( )
Called by the Routes middleware to dispatch the request to the
        appropriate controller.  If a webob exception is raised, it is
        returned; if some other exception is raised, the webob
        `HTTPInternalServerError` exception is raised.  Otherwise, the
        return value of the controller is returned.