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 ef4e5ec  [bugfix] Fixing regression from #4500 (#4549)
ef4e5ec is described below

commit ef4e5ecedf2fd5121122b8c4fb27eb259104e057
Author: John Bodley <4567245+john-bod...@users.noreply.github.com>
AuthorDate: Tue Mar 6 21:19:13 2018 -0800

    [bugfix] Fixing regression from #4500 (#4549)
---
 superset/viz.py     |  4 ++--
 tests/core_tests.py | 11 ++++++++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/superset/viz.py b/superset/viz.py
index 3595ebf..9225e5d 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -288,7 +288,7 @@ class BaseViz(object):
 
         df = payload.get('df')
         if self.status != utils.QueryStatus.FAILED:
-            if df is None or df.empty:
+            if df is not None and df.empty:
                 payload['error'] = 'No data'
             else:
                 payload['data'] = self.get_data(df)
@@ -611,7 +611,7 @@ class MarkupViz(BaseViz):
         return None
 
     def get_df(self, query_obj=None):
-        return pd.DataFrame()
+        return None
 
     def get_data(self, df):
         markup_type = self.form_data.get('markup_type')
diff --git a/tests/core_tests.py b/tests/core_tests.py
index 43a3bdf..e4df8bf 100644
--- a/tests/core_tests.py
+++ b/tests/core_tests.py
@@ -922,7 +922,7 @@ class CoreTests(SupersetTestCase):
 
         data = self.get_json_resp(url)
         self.assertEqual(data['status'], utils.QueryStatus.SUCCESS)
-        assert 'No data' in data['error']
+        self.assertEqual(data['error'], 'No data')
 
     def test_slice_payload_invalid_query(self):
         self.login(username='admin')
@@ -937,6 +937,15 @@ class CoreTests(SupersetTestCase):
         self.assertEqual(data['status'], utils.QueryStatus.FAILED)
         assert 'KeyError' in data['stacktrace']
 
+    def test_slice_payload_viz_markdown(self):
+        self.login(username='admin')
+        slc = self.get_slice('Title', db.session)
+
+        url = slc.get_explore_url(base_url='/superset/explore_json')
+        data = self.get_json_resp(url)
+        self.assertEqual(data['status'], None)
+        self.assertEqual(data['error'], None)
+
 
 if __name__ == '__main__':
     unittest.main()

-- 
To stop receiving notification emails like this one, please contact
maximebeauche...@apache.org.

Reply via email to