Skip to content

Commit

Permalink
[bufix] filtered column was removed (apache#4921)
Browse files Browse the repository at this point in the history
if a filter is created on a chart, and the column is removed from the
dataset, you get a "'NoneType' object has no attribute
'is_num'" 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.

(cherry picked from commit e213ccd)
  • Loading branch information
mistercrunch committed Jun 7, 2018
1 parent ff04e7c commit 3a5fa69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions superset/assets/src/chart/chartAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
10 changes: 5 additions & 5 deletions superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,12 @@ def get_sqla_query( # sqla
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:
Expand Down
4 changes: 2 additions & 2 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
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
Expand Down Expand Up @@ -367,7 +367,7 @@ def get_df_payload(self, query_obj=None):
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()

Expand Down

0 comments on commit 3a5fa69

Please sign in to comment.