[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] 02/02: tolerating non fractional amounts given
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] 02/02: tolerating non fractional amounts given |
Date: |
Thu, 16 Nov 2017 13:54:43 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository bank.
commit 6e0b64b58d0b2c566ab28ffbc2ac2037999e16e2
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Nov 16 13:53:50 2017 +0100
tolerating non fractional amounts given
---
talerbank/app/views.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index a859590..4567aa1 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -26,6 +26,7 @@ import requests
import django.contrib.auth
import django.contrib.auth.views
import django.contrib.auth.forms
+from decimal import Decimal
from django.db import transaction
from django import forms
from django.conf import settings
@@ -91,7 +92,7 @@ def get_session_flag(request, name):
class WTForm(forms.Form):
'''Form used to wire transfer funds internally in the bank.'''
- amount = forms.DecimalField(label=settings.TALER_CURRENCY)
+ amount = forms.FloatField(label=settings.TALER_CURRENCY)
counterpart = forms.IntegerField()
subject = forms.CharField()
@@ -103,8 +104,10 @@ def profile_page(request):
if request.method == "POST":
wtf = WTForm(request.POST)
if wtf.is_valid():
+ amount_parts = (settings.TALER_CURRENCY,
+ wtf.cleaned_data.get("amount") + 0.0)
try:
- wire_transfer(Amount.parse(settings.TALER_CURRENCY + ":" +
str(wtf.cleaned_data.get("amount"))),
+ wire_transfer(Amount.parse("%s:%s" % amount_parts),
BankAccount.objects.get(user=request.user),
BankAccount.objects.get(account_no=wtf.cleaned_data.get("counterpart")),
wtf.cleaned_data.get("subject"))
--
To stop receiving notification emails like this one, please contact
address@hidden