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 2020/05/21 08:16:30 UTC

[GitHub] [airflow] ashb commented on a change in pull request #8940: Remove side-effect of session in FAB

ashb commented on a change in pull request #8940:
URL: https://github.com/apache/airflow/pull/8940#discussion_r428511353



##########
File path: airflow/www/app.py
##########
@@ -95,9 +96,18 @@ def create_app(config=None, session=None, testing=False, app_name="Airflow"):
                 """Your CUSTOM_SECURITY_MANAGER must now extend AirflowSecurityManager,
                  not FAB's security manager.""")
 
-        appbuilder = AppBuilder(
-            app,
-            db.session if not session else session,
+        class AirflowAppBuilder(AppBuilder):
+
+            def add_view(self, baseview, *args, **kwargs):
+                if hasattr(baseview, 'datamodel'):
+                    # Delete sessions if initiated previously to limit side effects. We want to use
+                    # the current session in the current application.
+                    baseview.datamodel.session = None

Review comment:
       I think I had to work around this (or at least it bit me) when I was doing the TZ work in the UI
   
   :+1:




----------------------------------------------------------------
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:
users@infra.apache.org