diff --git a/app/scodoc/TrivialFormulator.py b/app/scodoc/TrivialFormulator.py index f3c768a2db..0c7e376227 100644 --- a/app/scodoc/TrivialFormulator.py +++ b/app/scodoc/TrivialFormulator.py @@ -370,12 +370,23 @@ class TF(object): self.values[field] = True else: self.values[field] = False - # open('/tmp/toto','a').write('checkvalues: val=%s (%s) values[%s] = %s\n' % (val, type(val), field, self.values[field])) if descr.get("convert_numbers", False): if typ[:3] == "int": - self.values[field] = int(self.values[field]) + try: + self.values[field] = int(self.values[field]) + except ValueError: + msg.append( + f"valeur invalide ({self.values[field]}) pour le champs {field}" + ) + ok = False elif typ == "float" or typ == "real": - self.values[field] = float(self.values[field].replace(",", ".")) + try: + self.values[field] = float(self.values[field].replace(",", ".")) + except ValueError: + msg.append( + f"valeur invalide ({self.values[field]}) pour le champs {field}" + ) + ok = False if ok: self.result = self.values else: diff --git a/sco_version.py b/sco_version.py index 63669db8c3..6fe40c0502 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.4.46" +SCOVERSION = "9.4.47" SCONAME = "ScoDoc"