villebro commented on code in PR #21931:
URL: https://github.com/apache/superset/pull/21931#discussion_r1004969438


##########
superset/reports/commands/execute.py:
##########
@@ -77,11 +77,22 @@
 logger = logging.getLogger(__name__)
 
 
-def _get_user() -> User:
-    user = 
security_manager.find_user(username=app.config["THUMBNAIL_SELENIUM_USER"])
-    if not user:
-        raise ReportScheduleSelleniumUserNotFoundError()
-    return user
+def _get_user(report_schedule: ReportSchedule) -> User:
+    user_types = app.config["ALERT_REPORTS_EXECUTE_AS"]
+    for user_type in user_types:
+        if user_type == "selenium":
+            return app.config["THUMBNAIL_SELENIUM_USER"]
+        if user_type == "creator":
+            if user := report_schedule.created_by:

Review Comment:
   Hmm, I do believe it is: 
https://docs.python.org/3/whatsnew/3.8.html#assignment-expressions



-- 
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]

Reply via email to