This is an automated email from the ASF dual-hosted git repository.

suddjian pushed a commit to branch fix/dash-change-chart-title
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit 313bddb0fdd37ec16eae6dd9fa6af21354942426
Author: David Aaron Suddjian <[email protected]>
AuthorDate: Wed Aug 5 15:43:38 2020 -0700

    comprehensions > loops
---
 superset/dashboards/dao.py | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/superset/dashboards/dao.py b/superset/dashboards/dao.py
index 7a4ee14..d56dea4 100644
--- a/superset/dashboards/dao.py
+++ b/superset/dashboards/dao.py
@@ -88,14 +88,11 @@ class DashboardDAO(BaseDAO):
     ) -> None:
         positions = data["positions"]
         # find slices in the position data
-        slice_ids = []
-        for value in positions.values():
-            if isinstance(value, dict):
-                try:
-                    slice_id = value["meta"]["chartId"]
-                    slice_ids.append(slice_id)
-                except KeyError:
-                    pass
+        slice_ids = [
+            value.get("meta", {}).get("chartId")
+            for value in positions.values()
+            if isinstance(value, dict)
+        ]
 
         current_slices = 
db.session.query(Slice).filter(Slice.id.in_(slice_ids)).all()
         dashboard.slices = current_slices

Reply via email to