You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/07/29 17:42:08 UTC

[GitHub] [airflow] dstandish commented on a diff in pull request #25402: Refactor DAG pages to be consistent

dstandish commented on code in PR #25402:
URL: https://github.com/apache/airflow/pull/25402#discussion_r933489202


##########
airflow/www/views.py:
##########
@@ -1237,31 +1237,27 @@ def legacy_code(self):
     @provide_session
     def code(self, dag_id, session=None):
         """Dag Code."""
-        all_errors = ""
-        dag_orm = None
+        dag = get_airflow_app().dag_bag.get_dag(dag_id, session=session)
+        dag_model = DagModel.get_dagmodel(dag_id, session=session)
+        if not dag:
+            flash(f'DAG "{dag_id}" seems to be missing.', "error")
+            return redirect(url_for('Airflow.index'))

Review Comment:
   ```
           dag = get_airflow_app().dag_bag.get_dag(dag_id, session=session)
           if not dag:
               flash(f'DAG "{dag_id}" seems to be missing.', "error")
               return redirect(url_for('Airflow.index'))
   ```
   
   curious why we add this portion?  it seems that we didn't previously retrieve the dag object?



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