From e182f7f96227ef699c1e55c43bb97f8df2fa5f12 Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Wed, 10 Jan 2018 08:54:18 +0800 Subject: [PATCH] fix since or until is empty value #4170 (#4176) --- superset/viz.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/superset/viz.py b/superset/viz.py index a97b04e9850..8bb65824d1a 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -173,8 +173,10 @@ class BaseViz(object): self.time_shift = utils.parse_human_timedelta(time_shift) - from_dttm = utils.parse_human_datetime(since) - self.time_shift - to_dttm = utils.parse_human_datetime(until) - self.time_shift + since = utils.parse_human_datetime(since) + until = utils.parse_human_datetime(until) + from_dttm = None if since is None else (since - self.time_shift) + to_dttm = None if until is None else (until - self.time_shift) if from_dttm and to_dttm and from_dttm > to_dttm: raise Exception(_('From date cannot be larger than to date'))