softyoungha commented on code in PR #40775:
URL: https://github.com/apache/airflow/pull/40775#discussion_r1690324878


##########
airflow/providers_manager.py:
##########
@@ -467,7 +468,7 @@ def _init_airflow_core_hooks(self):
                 connection_type=None,
                 connection_testable=False,
             )
-        for cls in [FSHook, PackageIndexHook]:
+        for cls in [FSHook, PackageIndexHook, PythonVirtualenvHook]:

Review Comment:
   @jscheffl
   I found the reason!
   The reason was `validators=[InputRequired()]`:
   ```python
   "requirements": StringField(  
       lazy_gettext("Requirements"),  
       description=lazy_gettext("Python Requirements follows PEP 508 format."), 
 
       widget=BS3TextAreaFieldWidget(),  
       validators=[InputRequired()],    # <- here
   )
   ```
   
   Because of this, when a POST request is made to `/connection/add` by 
flask_appbuilder, the required field(`extra__python_venv__requirements`) is not 
filled and so shows an alert, not "Added Row"(success message)
   
   
   > here is the html response in 
https://github.com/apache/airflow/blob/a6c88302bdb46702f00568db4fdc709c31bb69f6/tests/www/views/test_views_connection.py#L55-L59
 
   
   ```html
   ...
               <textarea class="form-control" 
id="extra__python_venv__requirements" name="extra__python_venv__requirements" 
placeholder="Requirements" required rows="3">
   </textarea>
                 <span class="help-block">Python Requirements follows PEP 508 
format.</span>
             
               <div class="alert alert-danger">
               
                 This field is required.
               
               </div>
   ...
   ```
   
   `InputRequired` should not be used in validators anywhere else.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to