diff --git a/caravel/viz.py b/caravel/viz.py index 5754685711cd1..c33430f0dff6c 100644 --- a/caravel/viz.py +++ b/caravel/viz.py @@ -217,11 +217,12 @@ def query_obj(self): def cache_timeout(self): if self.slice and self.slice.cache_timeout: return self.slice.cache_timeout - return ( - self.datasource.cache_timeout or - # Kim: comment this out since it caused a bug for DruidDatasource. - # self.datasource.database.cache_timeout or - config.get("CACHE_DEFAULT_TIMEOUT")) + if self.datasource.cache_timeout: + return self.datasource.cache_timeout + if hasattr(self.datasource, 'database') \ + and self.datasource.database.cache_timeout: + return self.datasource.database.cache_timeout + return config.get("CACHE_DEFAULT_TIMEOUT") def get_json(self): """Handles caching around the json payload retrieval"""