mistercrunch closed pull request #4549: [bugfix] Fixing regression from #4500
URL: https://github.com/apache/incubator-superset/pull/4549
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/viz.py b/superset/viz.py
index 3595ebf767..9225e5da8f 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -288,7 +288,7 @@ def get_payload(self, query_obj=None):
 
         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 @@ def query_obj(self):
         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 43a3bdfc71..e4df8bf05c 100644
--- a/tests/core_tests.py
+++ b/tests/core_tests.py
@@ -922,7 +922,7 @@ def test_slice_payload_no_data(self):
 
         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 @@ def test_slice_payload_invalid_query(self):
         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()


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to