gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-bank] 01/04: remove (dead) sample_donations and lint


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] 01/04: remove (dead) sample_donations and linting accounts generator
Date: Fri, 03 Nov 2017 17:53:38 +0100

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

marcello pushed a commit to branch master
in repository bank.

commit 505cbc42020eff1442d1a7f427299a49eea136db
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Nov 3 16:48:00 2017 +0100

    remove (dead) sample_donations and linting accounts
    generator
---
 INCLUDE.APP                                        |  1 -
 talerbank/app/management/commands/Makefile.am      |  3 +-
 talerbank/app/management/commands/dump_talerdb.py  | 12 ++--
 .../app/management/commands/sample_donations.py    | 71 ----------------------
 talerbank/talerconfig.py                           |  4 +-
 5 files changed, 10 insertions(+), 81 deletions(-)

diff --git a/INCLUDE.APP b/INCLUDE.APP
index c35d472..11f4a11 100644
--- a/INCLUDE.APP
+++ b/INCLUDE.APP
@@ -5,7 +5,6 @@ talerbank/app/funds_mgmt.py
 talerbank/app/history.py
 talerbank/app/lib.py
 talerbank/app/management/commands/pre_accounts.py
-talerbank/app/management/commands/sample_donations.py
 talerbank/app/models.py
 talerbank/app/my-static/style.css
 talerbank/app/privileged_accounts.py
diff --git a/talerbank/app/management/commands/Makefile.am 
b/talerbank/app/management/commands/Makefile.am
index 3fc6f2d..cec82a7 100644
--- a/talerbank/app/management/commands/Makefile.am
+++ b/talerbank/app/management/commands/Makefile.am
@@ -3,5 +3,4 @@ SUBDIRS = .
 EXTRA_DIST = \
   dump_talerdb.py \
   __init__.py \
-  provide_accounts.py \
-  sample_donations.py
+  provide_accounts.py
diff --git a/talerbank/app/management/commands/dump_talerdb.py 
b/talerbank/app/management/commands/dump_talerdb.py
index dc6d81f..5685da1 100644
--- a/talerbank/app/management/commands/dump_talerdb.py
+++ b/talerbank/app/management/commands/dump_talerdb.py
@@ -14,13 +14,13 @@
 #
 #  @author Marcello Stanisci
 
+import sys
+import logging
 from django.core.management.base import BaseCommand
-from ...models import BankAccount, BankTransaction
 from django.db.utils import OperationalError, ProgrammingError
-import logging
-import sys
+from ...models import BankAccount, BankTransaction
 
-logger = logging.getLogger(__name__)
+LOGGER = logging.getLogger(__name__)
 
 def dump_accounts():
     try:
@@ -31,7 +31,7 @@ def dump_accounts():
         for acc in accounts:
             print(acc.user.username + " has account number " + 
str(acc.account_no))
     except (OperationalError, ProgrammingError):
-        logger.error("likely causes: non existent DB or unmigrated project\n"
+        LOGGER.error("likely causes: non existent DB or unmigrated project\n"
                      "(try 'taler-bank-manage django migrate' in the latter 
case)",
                      stack_info=False,
                      exc_info=True)
@@ -51,7 +51,7 @@ def dump_history():
             msg.append(item.subject)
             print(''.join(msg))
     except (OperationalError, ProgrammingError):
-        logger.error("likely causes: non existent DB or unmigrated project\n"
+        LOGGER.error("likely causes: non existent DB or unmigrated project\n"
                      "(try 'taler-bank-manage django migrate' in the latter 
case)",
                      stack_info=False,
                      exc_info=True)
diff --git a/talerbank/app/management/commands/sample_donations.py 
b/talerbank/app/management/commands/sample_donations.py
deleted file mode 100644
index 35749a6..0000000
--- a/talerbank/app/management/commands/sample_donations.py
+++ /dev/null
@@ -1,71 +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, see <http://www.gnu.org/licenses/>
-#
-#  @author Marcello Stanisci
-
-from random import randint
-from django.core.management.base import BaseCommand
-from ...funds import wire_transfer_in_out
-from django.conf import settings
-from django.db.utils import OperationalError, ProgrammingError
-from ...models import BankAccount
-import logging
-import sys
-
-logger = logging.getLogger(__name__)
-
-public_accounts = []
-def sample_donations():
-    counter = -1
-    try:
-        public_accounts = BankAccount.objects.filter(is_public=True)
-        if len(public_accounts) is 0:
-            logger.warning("No public accounts still activated. Run 
'taler-bank-manage"
-                           " django provide_accounts' first")            
-        for account in public_accounts:
-            logger.debug("*")
-            for i in range(0, 9):
-                counter += 1
-                if account.user.username in settings.TALER_EXPECTS_DONATIONS:
-                    value = randint(1, 100)
-                    try:
-                        # 1st take money from bank and give to exchange
-                        wire_transfer_in_out({'value': value,
-                                              'fraction': 0,
-                                              'currency': 
settings.TALER_CURRENCY},
-                                             1,
-                                             2,
-                                             "Test-withdrawal-%d" % counter)
-    
-                        # 2nd take money from exchange and give to donation 
receiver
-                        wire_transfer_in_out({'value': value,
-                                              'fraction': 0,
-                                              'currency': 
settings.TALER_CURRENCY},
-                                             2,
-                                             account.account_no,
-                                             "Test-donation-%d" % counter)
-                    except BankAccount.DoesNotExist:
-                        logger.error("(At least) one account is not found. Run 
"
-                                     "'taler-bank-manage django 
provide_accounts' beforehand")
-                        sys.exit(1)
-    except (ProgrammingError, OperationalError):
-        logger.error("likely causes: non existent DB or unmigrated project\n"
-                     "(try 'taler-bank-manage django migrate' in the latter 
case)",
-                     stack_info=False,
-                     exc_info=True)
-        sys.exit(1)
-
-class Command(BaseCommand):
-    def handle(self, *args, **options):
-        sample_donations()
diff --git a/talerbank/talerconfig.py b/talerbank/talerconfig.py
index b686240..f9157f0 100644
--- a/talerbank/talerconfig.py
+++ b/talerbank/talerconfig.py
@@ -191,6 +191,8 @@ class TalerConfig:
         """
         self.sections = SectionDict()
 
+    # defaults != config file: the first is the 'base'
+    # whereas the second overrides things from the first.
     @staticmethod
     def from_file(filename=None, load_defaults=True):
         cfg = TalerConfig()
@@ -199,7 +201,7 @@ class TalerConfig:
             if xdg:
                 filename = os.path.join(xdg, "taler.conf")
             else:
-                filename = os.path.expanduser("~/.config/taler.conf")
+                filename = os.path.expanduser("~/.config/taler.conf") # <- 
what if you aren't there!?
         if load_defaults:
             cfg.load_defaults()
         cfg.load_file(filename)

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



reply via email to

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