From f44cedeba4466a94f50ab31c6262dd03f85ad408 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 3 Dec 2018 09:23:09 +0100 Subject: [PATCH] Allow passing Decimals to FloatField --- fints/fields.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fints/fields.py b/fints/fields.py index 93c0821..20600ff 100644 --- a/fints/fields.py +++ b/fints/fields.py @@ -1,4 +1,5 @@ import datetime +import decimal import re import warnings @@ -118,6 +119,9 @@ class FloatField(DataElementField): def _parse_value(self, value): if isinstance(value, float): return value + + if isinstance(value, decimal.Decimal): + value = str(value.normalize()).replace(".", ",") _value = str(value) if not re.match(r'^(?:0|[1-9]\d*),(?:\d*[1-9]|)$', _value): -- 2.47.2