@webob.dec.wsgify(RequestClass=Request)<EOL><INDENT>def dispatch(self, req):<DEDENT>
<EOL>params = req.environ['<STR_LIT>'][<NUM_LIT:1>]<EOL>controller = params.pop('<STR_LIT>')<EOL>cont_class = controller.__class__<EOL>cont_name = "<STR_LIT>" % (cont_class.__module__, cont_class.__name__)<EOL>origin = req.remote_addr if req.remote_addr else '<STR_LIT>'<EOL>if req.remote_user:<EOL><INDENT>origin = '<STR_LIT>' % (origin, req.remote_user)<EOL><DEDENT>LOG.info("<STR_LIT>" %<EOL>(origin, req.method, req.url, cont_name))<EOL>try:<EOL><INDENT>return controller(req, params)<EOL><DEDENT>except webob.exc.HTTPException as e:<EOL><INDENT>return e<EOL><DEDENT>except exceptions.AppathyResponse as e:<EOL><INDENT>return e.response<EOL><DEDENT>except Exception as e:<EOL><INDENT>LOG.exception("<STR_LIT>" % cont_name)<EOL>return webob.exc.HTTPInternalServerError()<EOL><DEDENT>
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.