From be58bbf3bfb9e895b75e01b940321b5d07dbc9e9 Mon Sep 17 00:00:00 2001 From: Ronald Portier Date: Sun, 29 Oct 2017 12:31:52 +0100 Subject: [PATCH] [FIX] base_location_nuts: Prevent flake8 error for non-critical bare except. (#506) --- base_location_nuts/wizard/nuts_import.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/base_location_nuts/wizard/nuts_import.py b/base_location_nuts/wizard/nuts_import.py index 8e6223c56..ddca652ec 100644 --- a/base_location_nuts/wizard/nuts_import.py +++ b/base_location_nuts/wizard/nuts_import.py @@ -97,7 +97,10 @@ class NutsImport(models.TransientModel): if field_type == 'integer': try: value = int(value) - except: + except (ValueError, TypeError): + logger.warn( + "Value %s for field %s replaced by 0" % + (value, k)) value = 0 else: logger.debug("xpath = '%s', not found" % field_xpath)