feng-tao commented on a change in pull request #3648: [AIRFLOW-2786] Fix 
editing Variable with empty key crashing
URL: https://github.com/apache/incubator-airflow/pull/3648#discussion_r209002986
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -2012,9 +2012,20 @@ def varimport(self):
         except Exception as e:
             flash("Missing file or syntax error: {}.".format(e))
         else:
+            suc_count = fail_count = 0
             for k, v in d.items():
-                models.Variable.set(k, v, serialize_json=isinstance(v, dict))
-            flash("{} variable(s) successfully updated.".format(len(d)))
+                try:
+                    models.Variable.set(k, v, serialize_json=isinstance(v, 
dict))
+                except Exception as e:
+                    logging.warning(e)
 
 Review comment:
   I am wondering do we want to know about what is the exception and why it 
fails? And why use warning to log the exception?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to