From 9a119e763f602c7b3fc9b0d37ad8b86898703452 Mon Sep 17 00:00:00 2001 From: Vera Liu Date: Wed, 8 Feb 2017 16:17:27 -0800 Subject: [PATCH] Raise exception when date range is wrong --- superset/viz.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/superset/viz.py b/superset/viz.py index 889127f38ce2b..85ee8dce5f6d7 100755 --- a/superset/viz.py +++ b/superset/viz.py @@ -163,8 +163,7 @@ def query_obj(self): until = extra_filters.get('__to') or form_data.get("until", "now") to_dttm = utils.parse_human_datetime(until) if from_dttm > to_dttm: - flasher("The date range doesn't seem right.", "danger") - from_dttm = to_dttm # Making them identical to not raise + raise Exception("From date cannot be larger than to date") # extras are used to query elements specific to a datasource type # for instance the extra where clause that applies only to Tables @@ -329,8 +328,7 @@ def get_values_for_column(self, column): until = form_data.get("until", "now") to_dttm = utils.parse_human_datetime(until) if from_dttm > to_dttm: - flasher("The date range doesn't seem right.", "danger") - from_dttm = to_dttm # Making them identical to not raise + raise Exception("From date cannot be larger than to date") kwargs = dict( column_name=column,