commit 7c068c6cbc8584d19b90b3822e9874574a0c35a5
parent 2030c9eee0970f17798dea700cb21027b3f7a6f3
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date: Mon, 20 Feb 2017 21:59:26 +0100
Half-baking string_to_amount
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/Python/lib/pytaler/amounts.py b/Python/lib/pytaler/amounts.py
@@ -14,11 +14,18 @@
#
# @author Marcello Stanisci
+import re
+
FRACTION = 100000000
def amount_get_zero(currency):
return {"value": 0, "fraction": 0, "currency": currency}
+def string_to_amount(fmt):
+ pattern = re.compile("^[0-9]+\.[0-9]+:[A-Z]+$")
+ assert(pattern.match(fmt))
+ # TBD
+
def amount_sum(a1, a2):
assert(a1['currency'] == a2['currency'])