From 81366e656961fb506c3051c0086e3c0682161c72 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 31 Jan 2022 22:53:11 +0100 Subject: [PATCH] =?UTF-8?q?Am=C3=A9liore=20check=20min/max=20dans=20ancien?= =?UTF-8?q?s=20formulaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/TrivialFormulator.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/scodoc/TrivialFormulator.py b/app/scodoc/TrivialFormulator.py index 23b500393f..25442194f2 100644 --- a/app/scodoc/TrivialFormulator.py +++ b/app/scodoc/TrivialFormulator.py @@ -276,14 +276,24 @@ class TF(object): ) ok = 0 if typ[:3] == "int" or typ == "float" or typ == "real": - if "min_value" in descr and val < descr["min_value"]: + if ( + val != "" + and val != None + and "min_value" in descr + and val < descr["min_value"] + ): msg.append( "La valeur (%d) du champ '%s' est trop petite (min=%s)" % (val, field, descr["min_value"]) ) ok = 0 - if "max_value" in descr and val > descr["max_value"]: + if ( + val != "" + and val != None + and "max_value" in descr + and val > descr["max_value"] + ): msg.append( "La valeur (%s) du champ '%s' est trop grande (max=%s)" % (val, field, descr["max_value"])