def match_request(self, req): if req.path_info.startswith('/projects'): path_info = req.path_info[10:] if path_info: self.log.debug('TracForgeDispatch: Starting WSGI relaunch for %s (%s)', path_info, req.method) project = path_info.split('/', 1)[0] # Check that we aren't trying to recurse (possible link loop) if project == os.path.basename(self.env.path): req.redirect(req.href()) # Assert permissions on the desination environment try: project_env = open_environment(os.path.join(os.path.dirname(self.env.path), project)) except IOError: raise TracError('No such project "%s"'%project) authname = RequestDispatcher(self.env).authenticate(req) project_perm = PermissionCache(project_env, authname) project_perm.assert_permission('PROJECT_VIEW') self.log.debug('TracForgeDispath: Access granted, running relaunch') self.log.debug('TracForgeDispatch: Status of req.args is %r', req.__dict__.get('args', 'NOT FOUND')) #self.log.debug('TracForgeDispatch: wsgi.input contains %s', req.read()) self._send_project(req, path_info) self.log.debug('TracForgeDispatch: Relaunch completed, terminating request') self.log.debug('TracForgeDispatch: Response was %r', req._response) req._tf_print = True raise RequestDone, 'request done'
def process_request(self, req): raise TracError('How did I get here?') path_info = req.path_info[10:] if path_info: project = path_info.split('/', 1)[0] # Check that we aren't trying to recurse (possible link loop) if project == os.path.basename(self.env.path): req.redirect(req.href()) # Assert permissions on the desination environment project_path = os.path.join(os.path.dirname(self.env.path), project) try: project_env = open_environment(project_path) except IOError: raise TracError('No such project "%s" at %s'% (project,project_path)) project_perm = PermissionCache(project_env, req.authname) project_perm.assert_permission('PROJECT_VIEW') return self._send_project(req, path_info) else: return self._send_index(req)