Why not: `g.view_func = self.app.view_functions.get(request.endpoint)`?