You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "hussein-awala (via GitHub)" <gi...@apache.org> on 2023/09/01 22:21:12 UTC

[GitHub] [airflow] hussein-awala commented on a diff in pull request #33975: Move the try outside the loop when this is possible in Airflow core

hussein-awala commented on code in PR #33975:
URL: https://github.com/apache/airflow/pull/33975#discussion_r1313589933


##########
airflow/www/extensions/init_security.py:
##########
@@ -56,14 +56,14 @@ def init_api_experimental_auth(app):
         pass
 
     app.api_auth = []
-    for backend in auth_backends.split(","):
-        try:
+    try:
+        for backend in auth_backends.split(","):
             auth = import_module(backend.strip())
             auth.init_app(app)
             app.api_auth.append(auth)
-        except ImportError as err:
-            log.critical("Cannot import %s for API authentication due to: %s", backend, err)
-            raise AirflowException(err)
+    except ImportError as err:
+        log.critical("Cannot import %s for API authentication due to: %s", backend, err)
+        raise AirflowException(err)

Review Comment:
   I had the same question because it seems useless. However I prefer to keep this PR changing the syntax without any change in the functionality, I will open some new PR to improve the raised exceptions.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org