forked from ScoDoc/ScoDoc
Fix: formulaires: saisie nombres/ exception
This commit is contained in:
parent
cac6201696
commit
7a7c2f1778
@ -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:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.4.46"
|
||||
SCOVERSION = "9.4.47"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user