superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: [bugfix] markup and iframe viz raise 'Empty query' (#4225)
Date Wed, 17 Jan 2018 21:54:12 GMT
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 5897d85  [bugfix] markup and iframe viz raise 'Empty query' (#4225)
5897d85 is described below

commit 5897d85f7a0296686e3e972f8155bce3200da594
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Wed Jan 17 13:54:10 2018 -0800

    [bugfix] markup and iframe viz raise 'Empty query' (#4225)
    
    closes https://github.com/apache/incubator-superset/issues/4222
    
    Related to: https://github.com/apache/incubator-superset/pull/4016
---
 superset/views/core.py |  3 +--
 superset/viz.py        | 14 ++++++++++----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/superset/views/core.py b/superset/views/core.py
index 1cd3593..ec4cce1 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1035,8 +1035,7 @@ class Superset(BaseSupersetView):
             return self.get_query_string_response(viz_obj)
 
         try:
-            payload = viz_obj.get_payload(
-                force=force)
+            payload = viz_obj.get_payload(force=force)
         except Exception as e:
             logging.exception(e)
             return json_error_response(utils.error_msg_from_exception(e))
diff --git a/superset/viz.py b/superset/viz.py
index e89dca9..9d6a57d 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -243,12 +243,12 @@ class BaseViz(object):
     def get_payload(self, force=False):
         """Handles caching around the json payload retrieval"""
         query_obj = self.query_obj()
-        cache_key = self.cache_key(query_obj)
+        cache_key = self.cache_key(query_obj) if query_obj else None
         cached_dttm = None
         data = None
         stacktrace = None
         rowcount = None
-        if not force and cache:
+        if cache_key and cache and not force:
             cache_value = cache.get(cache_key)
             if cache_value:
                 stats_logger.incr('loaded_from_cache')
@@ -536,7 +536,10 @@ class MarkupViz(BaseViz):
     verbose_name = _('Markup')
     is_timeseries = False
 
-    def get_df(self):
+    def query_obj(self):
+        return None
+
+    def get_df(self, query_obj=None):
         return None
 
     def get_data(self, df):
@@ -1573,7 +1576,10 @@ class IFrameViz(BaseViz):
     credits = 'a <a href="https://github.com/airbnb/superset">Superset</a> original'
     is_timeseries = False
 
-    def get_df(self):
+    def query_obj(self):
+        return None
+
+    def get_df(self, query_obj=None):
         return None
 
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <commits@superset.apache.org>'].

Mime
View raw message