dpgaspar commented on a change in pull request #14287:
URL: https://github.com/apache/superset/pull/14287#discussion_r618486256
##########
File path: superset/charts/api.py
##########
@@ -954,7 +954,7 @@ def favorite_status(self, **kwargs: Any) -> Response:
charts = ChartDAO.find_by_ids(requested_ids)
if not charts:
return self.response_404()
- favorited_chart_ids = ChartDAO.favorited_ids(charts, g.user.id)
+ favorited_chart_ids = ChartDAO.favorited_ids(charts, g.user.get_id())
Review comment:
for reference:
https://github.com/maxcountryman/flask-login/blob/89ce0167a8603d2c53fa2d0d604a20bfe03c0eaf/flask_login/mixins.py#L75
##########
File path: superset/db_engine_specs/base.py
##########
@@ -1024,7 +1024,7 @@ def estimate_query_cost(
if not cls.get_allow_cost_estimate(extra):
raise Exception("Database does not support cost estimation")
- user_name = g.user.username if g.user else None
+ user_name = g.user.username if g.user and hasattr(g.user, "username")
else None
Review comment:
it probably makes more sense to just check if the user is authenticated,
using `g.user.is_authenticated`
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]