From 2d6203d902b1649935261d77bb4ecd1bc2d2c3b4 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 9 Oct 2017 20:59:11 -0700 Subject: [PATCH] [bugfix] empty From date filter NoneType error (#3633) Error "AttributeError: 'NoneType' object has no attribute 'split'" is fired. --- superset/viz.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/superset/viz.py b/superset/viz.py index 953d815768368..a800bc0375a88 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -158,10 +158,11 @@ def query_obj(self): until = form_data.get("until", "now") # Backward compatibility hack - since_words = since.split(' ') - grains = ['days', 'years', 'hours', 'day', 'year', 'weeks'] - if (len(since_words) == 2 and since_words[1] in grains): - since += ' ago' + if since: + since_words = since.split(' ') + grains = ['days', 'years', 'hours', 'day', 'year', 'weeks'] + if (len(since_words) == 2 and since_words[1] in grains): + since += ' ago' from_dttm = utils.parse_human_datetime(since)