From 367059ddef14a495e277f68ceaf3455c092f839d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 11 Apr 2023 12:27:23 +0200 Subject: bandit checker: mark false security issues - fix security issues (low severity) --- archaeological_operations/utils.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'archaeological_operations/utils.py') 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) -- cgit v1.2.3