summaryrefslogtreecommitdiff
path: root/archaeological_operations/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/utils.py')
-rw-r--r--archaeological_operations/utils.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/archaeological_operations/utils.py b/archaeological_operations/utils.py
index ba4f17358..a571228b8 100644
--- a/archaeological_operations/utils.py
+++ b/archaeological_operations/utils.py
@@ -460,11 +460,11 @@ def parse_insee(value):
for value in values:
try:
town = Town.objects.get(numero_insee=value)
- towns.append(town)
- except:
+ except Town.DoesNotExist:
# sys.stderr.write('Numero INSEE : %s non existant en base'
# % value)
continue
+ towns.append(town)
return towns
@@ -482,8 +482,7 @@ def parse_parcels(parcel_str, insee_code=None, owner=None):
if insee_code:
town = parse_insee(insee_code)
# manage only one town at a time
- assert len(town) < 2
- if not town:
+ if len(town) >= 2 or not town:
return parcels
town = town[0]
m = PARCEL_YEAR_REGEXP.match(parcel_str)