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 2021/01/12 19:32:27 UTC

[GitHub] [airflow] soltanianalytics commented on a change in pull request #13640: Fixes problems with extras for custom connection types

soltanianalytics commented on a change in pull request #13640:
URL: https://github.com/apache/airflow/pull/13640#discussion_r556025425



##########
File path: airflow/www/views.py
##########
@@ -2894,9 +2894,13 @@ def action_muldelete(self, items):
 
     def process_form(self, form, is_created):
         """Process form data."""
-        formdata = form.data
-        if formdata['conn_type'] in ['jdbc', 'google_cloud_platform', 'grpc', 'yandexcloud', 'kubernetes']:
-            extra = {key: formdata[key] for key in self.extra_fields if key in formdata}
+        conn_type = form.data['conn_type']
+        extra = {
+            key: form.data[key]
+            for key in self.extra_fields
+            if key in form.data and key.startswith(f"extra__{conn_type}")

Review comment:
       Like in the `connection_form.js`, adding `__` at the end here avoids the (unlikely) case of substrings in the conn types, like so:
   ```Python
               if key in form.data and key.startswith(f"extra__{conn_type}__")
   ```




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