summaryrefslogtreecommitdiff
path: root/talerbank/app/management/commands
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2019-03-11 13:14:43 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2019-03-11 13:14:43 +0100
commit575666c5487847c360ad2b1ec3e2b920222d7faf (patch)
tree9f26eebfe21972c840c0984a8b0b1f7ff66e6939 /talerbank/app/management/commands
parentf3e30663867ce570d23d99e840351fae0fbca97c (diff)
downloadbank-575666c5487847c360ad2b1ec3e2b920222d7faf.tar.gz
bank-575666c5487847c360ad2b1ec3e2b920222d7faf.tar.bz2
bank-575666c5487847c360ad2b1ec3e2b920222d7faf.zip
Doxygen-commenting CLI utility 'provide_accounts'.
Diffstat (limited to 'talerbank/app/management/commands')
-rw-r--r--talerbank/app/management/commands/provide_accounts.py47
1 files changed, 30 insertions, 17 deletions
diff --git a/talerbank/app/management/commands/provide_accounts.py b/talerbank/app/management/commands/provide_accounts.py
index b8c84e5..a7d9820 100644
--- a/talerbank/app/management/commands/provide_accounts.py
+++ b/talerbank/app/management/commands/provide_accounts.py
@@ -1,22 +1,24 @@
-# This file is part of TALER
-# (C) 2014, 2015, 2106 INRIA
+##
+# 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 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.
+# 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/>
+# 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
-# @author Florian Dold
+# @author Marcello Stanisci
+# @author Florian Dold
+# @brief Create the basic accounts to make the demo bank work.
import sys
import logging
@@ -31,7 +33,10 @@ from ...amount import Amount
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.INFO)
-
+##
+# Create a new bank account.
+#
+# @param username the username to associate to this account.
def make_account(username):
try:
User.objects.get(username=username)
@@ -45,7 +50,8 @@ def make_account(username):
if "Survey" == username:
bank = BankAccount.objects.get(account_no=1)
survey = BankAccount.objects.get(account_no=8)
- wire_transfer(Amount(settings.TALER_CURRENCY, 10000000),
+ wire_transfer(Amount(settings.TALER_CURRENCY,
+ 10000000),
bank,
survey,
"Benevolent donation for 'Survey'")
@@ -58,9 +64,16 @@ def make_account(username):
exc_info=True)
sys.exit(1)
+##
+# Django-specific definition to register this command.
class Command(BaseCommand):
help = "Provide initial user accounts"
+ ##
+ # Django-specific definition to invoke the account creator
+ # @a make_account; it iterates over the list of basic accounts
+ # (defined in the settings) and invoke the account creator
+ # for each one of them.
def handle(self, *args, **options):
for username in settings.TALER_PREDEFINED_ACCOUNTS:
make_account(username)