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 2019/10/01 09:58:09 UTC

[GitHub] [airflow] ashb commented on a change in pull request #6109: [AIRFLOW-5490] Fix incorrect None comparison

ashb commented on a change in pull request #6109: [AIRFLOW-5490] Fix incorrect None comparison
URL: https://github.com/apache/airflow/pull/6109#discussion_r329973463
 
 

 ##########
 File path: airflow/www/security.py
 ##########
 @@ -340,8 +340,8 @@ def clean_perms(self):
         pvms = (
             sesh.query(sqla_models.PermissionView)
             .filter(or_(
-                sqla_models.PermissionView.permission == None,  # noqa pylint: disable=singleton-comparison
-                sqla_models.PermissionView.view_menu == None,  # noqa pylint: disable=singleton-comparison
+                sqla_models.PermissionView.permission is None,  # noqa pylint: disable=singleton-comparison
 
 Review comment:
   This is not right:
   
   ```
   In [5]: type(TI.state is None)
   Out[5]: bool
   
   In [6]: type(TI.state == None)
   Out[6]: sqlalchemy.sql.elements.BinaryExpression
   ```
   
   I fyou want to avoid the wrong-looking `== None` the (`is_`)[https://docs.sqlalchemy.org/en/11/core/sqlelement.html#sqlalchemy.sql.operators.ColumnOperators.is_] function is the way to go.

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


With regards,
Apache Git Services