From 379b2591fd1d07196f81b76c47e0dbb87188e1ee Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 9 Aug 2021 10:25:45 +0200 Subject: [PATCH] convert ids to integers --- app/scodoc/TrivialFormulator.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/scodoc/TrivialFormulator.py b/app/scodoc/TrivialFormulator.py index d14d5e6a..e8871b12 100644 --- a/app/scodoc/TrivialFormulator.py +++ b/app/scodoc/TrivialFormulator.py @@ -206,10 +206,11 @@ class TF(object): if self.values[field] == None: self.values[field] = "" - # convert numbers - if type(self.values[field]) == type(1) or type(self.values[field]) == type( - 1.0 - ): + # convert numbers, except ids + if field.endswith("id") and self.values[field]: + # enforce integer ids: + self.values[field] = int(self.values[field]) + elif isinstance(self.values[field], (int, float)): self.values[field] = str(self.values[field]) # if "tf-checked" not in self.values: