diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-04-11 12:27:23 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-04-17 15:47:16 +0200 |
commit | 367059ddef14a495e277f68ceaf3455c092f839d (patch) | |
tree | ae625ff0265fecd122946c71d3a2d6afefae4817 /archaeological_operations/utils.py | |
parent | ff5aee7158bd46e4ae22bc431adadd7060a6e277 (diff) | |
download | Ishtar-367059ddef14a495e277f68ceaf3455c092f839d.tar.bz2 Ishtar-367059ddef14a495e277f68ceaf3455c092f839d.zip |
bandit checker: mark false security issues - fix security issues (low severity)
Diffstat (limited to 'archaeological_operations/utils.py')
-rw-r--r-- | archaeological_operations/utils.py | 7 |
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) |