john-bodley commented on code in PR #26200:
URL: https://github.com/apache/superset/pull/26200#discussion_r1417979904
##########
superset/models/dashboard.py:
##########
@@ -76,33 +76,27 @@ def copy_dashboard(_mapper: Mapper, connection: Connection,
target: Dashboard) -
if dashboard_id is None:
return
- session_class = sessionmaker(autoflush=False)
- session = session_class(bind=connection)
-
- try:
- new_user = session.query(User).filter_by(id=target.id).first()
-
- # copy template dashboard to user
- template =
session.query(Dashboard).filter_by(id=int(dashboard_id)).first()
- dashboard = Dashboard(
- dashboard_title=template.dashboard_title,
- position_json=template.position_json,
- description=template.description,
- css=template.css,
- json_metadata=template.json_metadata,
- slices=template.slices,
- owners=[new_user],
- )
- session.add(dashboard)
+ new_user = db.session.query(User).filter_by(id=target.id).first()
Review Comment:
Same logic without the `try` block.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]