From 3f0171b77be43adbce17a98b0e109e1935a6d96f Mon Sep 17 00:00:00 2001 From: Siddharth Gupta Date: Mon, 18 Apr 2016 09:00:03 -0700 Subject: [PATCH] Configure Visualizations (#365) * make viz types configurable * make visualizations configurable * deault every viz is true * add blacklist viz_type * fix build --- caravel/config.py | 9 +++++++++ caravel/viz.py | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/caravel/config.py b/caravel/config.py index 93930cc1b2847..18c9d5c69f064 100644 --- a/caravel/config.py +++ b/caravel/config.py @@ -121,6 +121,15 @@ CACHE_DEFAULT_TIMEOUT = None CACHE_CONFIG = {'CACHE_TYPE': 'null'} + +# --------------------------------------------------- +# List of viz_types not allowed in your environment +# For example: Blacklist pivot table and treemap: +# VIZ_TYPE_BLACKLIST = ['pivot_table', 'treemap'] +# --------------------------------------------------- + +VIZ_TYPE_BLACKLIST = [] + try: from caravel_config import * # noqa except Exception: diff --git a/caravel/viz.py b/caravel/viz.py index 9d5f56fc4fbaf..2765244f9e037 100644 --- a/caravel/viz.py +++ b/caravel/viz.py @@ -14,7 +14,6 @@ import uuid from collections import OrderedDict, defaultdict from datetime import datetime, timedelta - import pandas as pd import numpy as np from flask import flash, request, Markup @@ -1540,4 +1539,5 @@ def get_data(self): TreemapViz, ] -viz_types = OrderedDict([(v.viz_type, v) for v in viz_types_list]) +viz_types = OrderedDict([(v.viz_type, v) for v in viz_types_list + if v.viz_type not in config.get('VIZ_TYPE_BLACKLIST')])