diff --git a/superset/views/core.py b/superset/views/core.py index 3db014bbd634..87a121d21654 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -1276,7 +1276,9 @@ def explore(self, datasource_type=None, datasource_id=None): title = _("Explore - %(table)s", table=table_name) return self.render_template( "superset/basic.html", - bootstrap_data=json.dumps(bootstrap_data), + bootstrap_data=json.dumps( + bootstrap_data, default=utils.pessimistic_json_iso_dttm_ser + ), entry="explore", title=title, standalone_mode=standalone, @@ -2186,14 +2188,18 @@ def dashboard(**kwargs): } if request.args.get("json") == "true": - return json_success(json.dumps(bootstrap_data)) + return json_success( + json.dumps(bootstrap_data, default=utils.pessimistic_json_iso_dttm_ser) + ) return self.render_template( "superset/dashboard.html", entry="dashboard", standalone_mode=standalone_mode, title=dash.dashboard_title, - bootstrap_data=json.dumps(bootstrap_data), + bootstrap_data=json.dumps( + bootstrap_data, default=utils.pessimistic_json_iso_dttm_ser + ), ) @api @@ -2990,7 +2996,9 @@ def profile(self, username): "superset/basic.html", title=_("%(user)s's profile", user=username), entry="profile", - bootstrap_data=json.dumps(payload, default=utils.json_iso_dttm_ser), + bootstrap_data=json.dumps( + payload, default=utils.pessimistic_json_iso_dttm_ser + ), ) @has_access diff --git a/tests/core_tests.py b/tests/core_tests.py index 1e640493d3a7..50605a903696 100644 --- a/tests/core_tests.py +++ b/tests/core_tests.py @@ -963,11 +963,16 @@ def test_feature_flag_serialization(self): ) html = cgi.escape(encoded).replace("'", "'").replace('"', """) - data = self.get_resp("/superset/sqllab") - self.assertTrue(html in data) - - data = self.get_resp("/superset/welcome") - self.assertTrue(html in data) + urls = [ + "/superset/sqllab", + "/superset/welcome", + "/superset/dashboard/1/", + "/superset/profile/admin/", + "/superset/explore/table/1", + ] + for url in urls: + data = self.get_resp(url) + self.assertTrue(html in data) if __name__ == "__main__":