From e6e8ec96205f5a83e09362994a224857a266b8f3 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Thu, 14 Apr 2016 20:25:40 -0700 Subject: [PATCH] [bugfix] missing redirect when datasource is missing (#352) --- caravel/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/caravel/views.py b/caravel/views.py index ff499b04f8000..a056fd17d8437 100644 --- a/caravel/views.py +++ b/caravel/views.py @@ -449,6 +449,7 @@ class Caravel(BaseView): @expose("/datasource///") # Legacy url @log_this def explore(self, datasource_type, datasource_id): + error_redirect = '/slicemodelview/list/' datasource_class = models.SqlaTable \ if datasource_type == "table" else models.DruidDatasource datasources = ( @@ -469,6 +470,7 @@ def explore(self, datasource_type, datasource_id): ) if not datasource: flash("The datasource seems to have been deleted", "alert") + return redirect(error_redirect) all_datasource_access = self.appbuilder.sm.has_access( 'all_datasource_access', 'all_datasource_access') @@ -476,7 +478,7 @@ def explore(self, datasource_type, datasource_id): 'datasource_access', datasource.perm) if not (all_datasource_access or datasource_access): flash("You don't seem to have access to this datasource", "danger") - return redirect('/slicemodelview/list/') + return redirect(error_redirect) action = request.args.get('action') if action in ('save', 'overwrite'):