You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/05/02 22:24:47 UTC

[incubator-superset] branch master updated: [bufix] filtered column was removed (#4921)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new e213ccd  [bufix] filtered column was removed (#4921)
e213ccd is described below

commit e213ccd4385a1496fa1af12a2d88bc9b411d332f
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Wed May 2 15:24:44 2018 -0700

    [bufix] filtered column was removed (#4921)
    
    if a filter is created on a chart, and the column is removed from the
    dataset, you get a "&#39;NoneType&#39; object has no attribute
    &#39;is_num&#39;" or something to that
    effect. This fix disregards the filter.
    
    Also error messages were HTML escaped which React does already anyways
    so that's not necessary [anymore] here.
---
 superset/assets/src/chart/chartAction.js |  1 +
 superset/connectors/sqla/models.py       | 10 +++++-----
 superset/viz.py                          |  4 ++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/superset/assets/src/chart/chartAction.js b/superset/assets/src/chart/chartAction.js
index a2f0116..f1112f5 100644
--- a/superset/assets/src/chart/chartAction.js
+++ b/superset/assets/src/chart/chartAction.js
@@ -2,6 +2,7 @@ import { getExploreUrlAndPayload, getAnnotationJsonUrl } from '../explore/explor
 import { requiresQuery, ANNOTATION_SOURCE_TYPES } from '../modules/AnnotationTypes';
 import { Logger, LOG_ACTIONS_LOAD_EVENT } from '../logger';
 import { COMMON_ERR_MESSAGES } from '../common';
+import { t } from '../locales';
 
 const $ = window.$ = require('jquery');
 
diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index 9d6f57b..269b087 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -582,12 +582,12 @@ class SqlaTable(Model, BaseDatasource):
             col = flt['col']
             op = flt['op']
             col_obj = cols.get(col)
-            is_list_target = op in ('in', 'not in')
-            eq = self.filter_values_handler(
-                flt.get('val'),
-                target_column_is_numeric=col_obj.is_num,
-                is_list_target=is_list_target)
             if col_obj:
+                is_list_target = op in ('in', 'not in')
+                eq = self.filter_values_handler(
+                    flt.get('val'),
+                    target_column_is_numeric=col_obj.is_num,
+                    is_list_target=is_list_target)
                 if op in ('in', 'not in'):
                     cond = col_obj.sqla_col.in_(eq)
                     if '<NULL>' in eq:
diff --git a/superset/viz.py b/superset/viz.py
index de14f1a..7eb34c6 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -23,7 +23,7 @@ import traceback
 import uuid
 
 from dateutil import relativedelta as rdelta
-from flask import escape, request
+from flask import request
 from flask_babel import lazy_gettext as _
 import geohash
 from geopy.point import Point
@@ -368,7 +368,7 @@ class BaseViz(object):
             except Exception as e:
                 logging.exception(e)
                 if not self.error_message:
-                    self.error_message = escape('{}'.format(e))
+                    self.error_message = '{}'.format(e)
                 self.status = utils.QueryStatus.FAILED
                 stacktrace = traceback.format_exc()
 

-- 
To stop receiving notification emails like this one, please contact
maximebeauchemin@apache.org.