[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] branch master updated: #4822
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] branch master updated: #4822 |
Date: |
Mon, 06 Feb 2017 21:37:08 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository bank.
The following commit(s) were added to refs/heads/master by this push:
new 3ae843c #4822
3ae843c is described below
commit 3ae843c3a54e644efcc91a91609af014e5033e45
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Feb 6 21:34:41 2017 +0100
#4822
---
talerbank/app/views.py | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 86eb4a3..92c8c8a 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -18,6 +18,7 @@
import django.contrib.auth
import django.contrib.auth.views
import django.contrib.auth.forms
+from django.db import transaction
from django import forms
from django.conf import settings
from django.contrib.auth.decorators import login_required
@@ -218,9 +219,10 @@ def register(request):
password = form.cleaned_data["password"]
if User.objects.filter(username=username).exists():
return render(request, "register.html", dict(not_available=True))
- user = User.objects.create_user(username=username, password=password)
- user_account = BankAccount(user=user, currency=settings.TALER_CURRENCY)
- user_account.save()
+ with transaction.atomic():
+ user = User.objects.create_user(username=username, password=password)
+ user_account = BankAccount(user=user, currency=settings.TALER_CURRENCY)
+ user_account.save()
bank_internal_account = BankAccount.objects.get(account_no=1)
amount = dict(value=100, fraction=0, currency=settings.TALER_CURRENCY)
wire_transfer(amount, bank_internal_account, user_account, "Joining bonus")
@@ -373,6 +375,8 @@ def wire_transfer(amount,
subject=subject)
debit_account.balance -= float_amount
credit_account.balance += float_amount
- debit_account.save()
- credit_account.save()
- transaction_item.save()
+
+ with transaction.atomic():
+ debit_account.save()
+ credit_account.save()
+ transaction_item.save()
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-bank] branch master updated: #4822,
gnunet <=