[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-bank] branch master updated: finishing style migration, and delet
From: |
gnunet |
Subject: |
[taler-bank] branch master updated: finishing style migration, and deleting unused code. |
Date: |
Fri, 29 Nov 2019 22:34:53 +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 a626559 finishing style migration, and deleting unused code.
a626559 is described below
commit a626559464dc9cf969c7f9f5b9032065d5bb80a3
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Nov 29 22:31:56 2019 +0100
finishing style migration, and deleting unused code.
---
talerbank/app/schemas.py | 34 +++++++++++-----------------------
talerbank/app/views.py | 4 +---
2 files changed, 12 insertions(+), 26 deletions(-)
diff --git a/talerbank/app/schemas.py b/talerbank/app/schemas.py
index 6b529b3..26bda90 100644
--- a/talerbank/app/schemas.py
+++ b/talerbank/app/schemas.py
@@ -267,28 +267,16 @@ class WithdrawHeadless(BankValidator):
reserve_pub = forms.CharField(required=True)
exchange_wire_details = PaytoField(required=False)
-class WithdrawHeadlessUri(forms.Form):
- amount = forms.CharField(
- validators=[
- RegexValidator(
- AMOUNT_REGEX, message="Format CURRENCY:X[.Y] not respected"
- )
- ]
- )
+class WithdrawHeadlessUri(BankValidator):
+ def __init__(self, data):
+ super(WithdrawHeadlessUri, self).__init__(self.InnerValidator, data)
-class SenderWireDetails(forms.Form):
- # FIXME: must be changed to 'payto' format.
- type = forms.CharField()
- bank_url = forms.URLField()
- account_number = forms.IntegerField(min_value=1)
-
-
-class SenderWireDetailsField(forms.Field):
- def to_python(self, value):
- return value
-
- def validate(self, value):
- swd = SenderWireDetails(value)
- if not swd.is_valid():
- raise ValidationError(json.dumps(swd.errors.as_json()))
+ class InnerValidator(forms.Form):
+ amount = forms.CharField(
+ validators=[
+ RegexValidator(
+ AMOUNT_REGEX, message="Format CURRENCY:X[.Y] not respected"
+ )
+ ]
+ )
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 09278a3..518a309 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -901,9 +901,7 @@ def add_incoming(request, user_account):
@require_POST
def withdraw_headless_uri(request, user):
data = WithdrawHeadlessUri(json.loads(decode_body(request)))
- if not data.is_valid():
- raise JSONFieldException(data.errors, 400)
- amount = Amount.parse(data.cleaned_data["amount"])
+ amount = Amount.parse(data.get("amount"))
user_account = BankAccount.objects.get(user=user)
op = TalerWithdrawOperation(amount=amount, withdraw_account=user_account)
op.save()
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-bank] branch master updated: finishing style migration, and deleting unused code.,
gnunet <=