From 621a59cb0381cbe3d31d1eb51bd82e4ca95ee0aa Mon Sep 17 00:00:00 2001 From: Nick Barnwell Date: Tue, 18 Oct 2016 22:06:53 -0700 Subject: [PATCH 1/3] Fix 1325: Slice Cache Timeout Ignored, Default Used --- caravel/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/caravel/views.py b/caravel/views.py index 4f4958def5e82..e340d220c3f78 100755 --- a/caravel/views.py +++ b/caravel/views.py @@ -1171,6 +1171,9 @@ def get_viz( args=None, datasource_type=None, datasource_id=None): + + slice_id = slice_id or request.args.get('slice_id') + if slice_id: slc = db.session.query(models.Slice).filter_by(id=slice_id).one() return slc.get_viz() From 308f6da0086dbecf0c77e49ca6389ef7f695dfe6 Mon Sep 17 00:00:00 2001 From: Nick Barnwell Date: Tue, 18 Oct 2016 22:07:10 -0700 Subject: [PATCH 2/3] Make Tests Pass --- tests/core_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/core_tests.py b/tests/core_tests.py index 85599c288908b..f0c182b66f4e8 100644 --- a/tests/core_tests.py +++ b/tests/core_tests.py @@ -115,7 +115,7 @@ def test_save_slice(self): "datasource_id=1&datasource_type=table&previous_viz_type=sankey") db.session.commit() - resp = self.get_resp(url.format(tbl_id, slice_id, copy_name, 'save')) + resp = self.get_resp(url.format(tbl_id, slice_id, copy_name, 'saveas')) assert copy_name in resp assert 'Energy' in self.get_resp( url.format(tbl_id, slice_id, copy_name, 'overwrite')) @@ -201,7 +201,7 @@ def test_warm_up_cache(self): resp = self.get_resp( '/caravel/warm_up_cache?table_name=energy_usage&db_name=main') data = json.loads(resp) - assert len(data) == 3 + assert len(data) == 4 def test_shortner(self): self.login(username='admin') From d9ec8cae3e2059515e2abf73dc00f5cf92d44748 Mon Sep 17 00:00:00 2001 From: Nick Barnwell Date: Fri, 21 Oct 2016 21:34:09 -0700 Subject: [PATCH 3/3] Test suite is bonkers --- caravel/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caravel/views.py b/caravel/views.py index e340d220c3f78..85c45e61119b4 100755 --- a/caravel/views.py +++ b/caravel/views.py @@ -1172,7 +1172,7 @@ def get_viz( datasource_type=None, datasource_id=None): - slice_id = slice_id or request.args.get('slice_id') + slice_id = slice_id or args.get('slice_id') if slice_id: slc = db.session.query(models.Slice).filter_by(id=slice_id).one()