You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2023/03/07 05:31:00 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #29946: Delay ConnectionModelView init until it's accessed

uranusjr commented on code in PR #29946:
URL: https://github.com/apache/airflow/pull/29946#discussion_r1127360432


##########
airflow/www/views.py:
##########
@@ -4512,17 +4507,14 @@ def process_form(self, form, is_created):
                 del form.extra
         del extra_json
 
-        for key in self.extra_fields:
+        for key, field_name in form.extra_field_name_mapping.items():

Review Comment:
   `extra_fields` is removed since it is simply `extra_field_name_mapping.keys()`, but since Python 3.7 the dict maintains ordering on its own the extra list is not needed anymore.
   
   `extra_field_name_mapping` is delibrately moved to ConnectionForm since Flask-Appbuilder has some annoying introspecting mechanism that tries to resolve values on the view class too eagerly. Moving the property to the form class ensures it is only calculated when needed.



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