[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 "'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.
This commit is contained in:
Maxime Beauchemin 2018-05-02 15:24:44 -07:00 committed by GitHub
parent fa4acb1bda
commit e213ccd438
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -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');

View File

@ -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:

View File

@ -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()