gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-bank] branch master updated: fix list_accounts command


From: gnunet
Subject: [taler-bank] branch master updated: fix list_accounts command
Date: Sat, 18 Jan 2020 16:05:06 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository bank.

The following commit(s) were added to refs/heads/master by this push:
     new 4804a61  fix list_accounts command
4804a61 is described below

commit 4804a61c6fa6ec930435b4781873e79e77c9d0ee
Author: Florian Dold <address@hidden>
AuthorDate: Sat Jan 18 16:01:11 2020 +0100

    fix list_accounts command
---
 talerbank/app/management/commands/dump_talerdb.py  | 77 ----------------------
 talerbank/app/management/commands/list_accounts.py |  2 +-
 2 files changed, 1 insertion(+), 78 deletions(-)

diff --git a/talerbank/app/management/commands/dump_talerdb.py 
b/talerbank/app/management/commands/dump_talerdb.py
deleted file mode 100644
index bd40064..0000000
--- a/talerbank/app/management/commands/dump_talerdb.py
+++ /dev/null
@@ -1,77 +0,0 @@
-##
-# This file is part of TALER
-# (C) 2014, 2015, 2106 Taler Systems SA
-#
-# TALER is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; either version 3, or (at your
-# option) any later version.
-#
-# TALER is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public
-# License along with TALER; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>
-#
-# @author Marcello Stanisci
-# @brief dump database content in a pretty format.
-
-import sys
-import logging
-from django.core.management.base import BaseCommand
-from django.db.utils import OperationalError, ProgrammingError
-from ...models import BankAccount, BankTransaction
-
-LOGGER = logging.getLogger(__name__)
-
-
-##
-# Dump bank accounts that exist in the database.
-def dump_accounts():
-    try:
-        accounts = BankAccount.objects.all()
-        if accounts.count() < 1:
-            print("No accounts created yet..")
-            return
-        for acc in accounts:
-            print(acc.user.username + " has account number " + 
str(acc.account_no))
-    except (OperationalError, ProgrammingError):
-        LOGGER.error("Hard database error, does it exist?")
-        sys.exit(1)
-
-
-##
-# Dump all the transactions that exist in the database.
-def dump_history():
-    try:
-        history = BankTransaction.objects.all()
-        for item in history:
-            msg = []
-            msg.append("+%s, " % item.credit_account.account_no)
-            msg.append("-%s, " % item.debit_account.account_no)
-            msg.append(item.amount.stringify(2))
-            msg.append(" '" + item.subject + "'")
-            print("".join(msg))
-    except (OperationalError, ProgrammingError):
-        LOGGER.error("Hard database error, does it exist?")
-        sys.exit(1)
-
-
-##
-# Django-specific class that register this CLI utility.
-class Command(BaseCommand):
-
-    ##
-    # Django-specific callable that gets invoked when the user
-    # calls the CLI utility: simply, it calls the two helper
-    # functions defined above.
-    #
-    # @param self this object itself.
-    # @param args argument list (as passed by Django)
-    # @param options CLI options (also as passed by Django)
-    def handle(self, *args, **options):
-        dump_accounts()
-        dump_history()
diff --git a/talerbank/app/management/commands/list_accounts.py 
b/talerbank/app/management/commands/list_accounts.py
index 4294845..0677246 100644
--- a/talerbank/app/management/commands/list_accounts.py
+++ b/talerbank/app/management/commands/list_accounts.py
@@ -48,5 +48,5 @@ class Command(BaseCommand):
         accounts = BankAccount.objects.all().order_by("account_no")
         for account in accounts:
             print(
-                f"Account {repr(account.user.username)} 
(#{account.account_no}) balance {account.amount.stringify()}"
+                f"Account {repr(account.user.username)} balance 
{account.balance.stringify()}"
             )

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]