diff options
-rw-r--r-- | talerbank/app/__init__.py | 2 | ||||
-rw-r--r-- | talerbank/app/management/commands/check_db.py | 45 | ||||
-rw-r--r-- | talerbank/app/management/commands/sample_donations.py | 4 |
3 files changed, 4 insertions, 47 deletions
diff --git a/talerbank/app/__init__.py b/talerbank/app/__init__.py index e69de29..ecc3dff 100644 --- a/talerbank/app/__init__.py +++ b/talerbank/app/__init__.py @@ -0,0 +1,2 @@ +# make sure that checks are registered +from . import checks diff --git a/talerbank/app/management/commands/check_db.py b/talerbank/app/management/commands/check_db.py deleted file mode 100644 index 9fb82b9..0000000 --- a/talerbank/app/management/commands/check_db.py +++ /dev/null @@ -1,45 +0,0 @@ -# This file is part of TALER -# (C) 2014, 2015, 2106 INRIA -# -# 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, If not, see <http://www.gnu.org/licenses/> -# -# @author Marcello Stanisci - -from django.core.management.base import BaseCommand -from django.contrib.auth.models import User -from django.db.utils import OperationalError - - -def check_db(): - try: - bank = User.objects.get(username='Bank') - print ("The DB contains the bank's bank account, so it is assumed to" - " work properly") - except User.DoesNotExist: - print("\n*****WARNING*****\nCreate predefined accounts" - " before running the bank.\n" - "Try 'taler-bank-manage --preaccounts\n\n" - "**********\n") - return 1 - except OperationalError: - print("\n*****WARNING*****\n\nPlease create 'talertest'" - " database before running the bank.\n" - "Create also predefined accounts (with" - " 'taler-bank-manage --preaccounts')\n\n" - "**********\n") - return 1 - return 0 - - -class Command(BaseCommand): - def handle(self, *args, **options): - check_db() diff --git a/talerbank/app/management/commands/sample_donations.py b/talerbank/app/management/commands/sample_donations.py index 35caf04..2ded8d8 100644 --- a/talerbank/app/management/commands/sample_donations.py +++ b/talerbank/app/management/commands/sample_donations.py @@ -44,10 +44,10 @@ def sample_donations(): account.account_no, "Test donation(s)") except BankAccount.DoesNotExist: - print("Please create basic accounts before. Run taler-bank-manage --preaccounts") + print("Accounts not found. Run the 'provide_accounts' django management command") return except OperationalError: - print("No DB found, please create one beforehand. Try with taler-bank-manage --createdb") + print("No DB found, please create one beforehand. Try with taler-bank-manage createdb") return |