gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-bank] annotated tag v0.5.0 updated (63b86f0 -> b1e56


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] annotated tag v0.5.0 updated (63b86f0 -> b1e5637)
Date: Wed, 04 Apr 2018 00:23:06 +0200

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

dold pushed a change to annotated tag v0.5.0
in repository bank.

*** WARNING: tag v0.5.0 was modified! ***

    from 63b86f0  (tag)
      to b1e5637  (tag)
 tagging 98812fecb945befada5d2b3198e4cdb194ac5f57 (commit)
 replaces v0.4.0
      by Florian Dold
      on Wed Apr 4 00:22:51 2018 +0200

- Log -----------------------------------------------------------------
Official release v0.5.0
-----------------------------------------------------------------------

    from 9a72541  changelog
     add 3e2ddde  right version in autoconf
     add a9c36c8  remove old stuff from "dist"
     add 4b4f08c  squashing all migrations, keeping the old ones around (as 
suggested by Django) even though they are seemingly not used anymore..
     add f6db5e0  properly "dist"-ing the squashed migration.
     add 2ccd46c  adding new entries to "make dist".
     add c14d6c9  Do not use cookies for pagination, fix/simplify logic
     add 57b11ae  syntax/typo
     add 0c63974  add tipping/survey link
     add 98812fe  fix -c option

No new revisions were added by this update.

Summary of changes:
 Makefile.am                          |  1 -
 configure.ac                         |  2 +-
 taler-bank-manage.in                 |  3 +-
 talerbank/app/Makefile.am            |  4 +-
 talerbank/app/migrations/Makefile.am |  4 +-
 talerbank/app/static/Makefile.am     |  4 +-
 talerbank/app/templates/base.html    |  1 +
 talerbank/app/views.py               | 79 +++++++++++++++---------------------
 8 files changed, 42 insertions(+), 56 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 012f7b2..c6f5581 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,6 @@ EXTRA_DIST = \
  bank.conf \
  bank-check.conf \
  bank-check-alt-badamount.conf \
- bank-check-alt-baddb.conf \
  bank-check-alt-nocurrency.conf
 
 pkgcfgdir= $(prefix)/share/taler/config.d/
diff --git a/configure.ac b/configure.ac
index 4904365..f242d92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 # This script is in the public domain.
 AC_PREREQ(2.61)
-AC_INIT([taler-bank], [0.4.0], address@hidden)
+AC_INIT([taler-bank], [0.5.0], address@hidden)
 
 AC_CONFIG_MACRO_DIR([m4])
 
diff --git a/taler-bank-manage.in b/taler-bank-manage.in
index 935c8d5..5a2f8e5 100644
--- a/taler-bank-manage.in
+++ b/taler-bank-manage.in
@@ -21,7 +21,6 @@ site.addsitedir("%s/lib/python%d.%d/site-packages" % (
     sys.version_info.minor))
 
 LOGGER = logging.getLogger(__name__)
-TC = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE"))
 
 # No perfect match to our logging format, but good enough ...
 UWSGI_LOGFMT = "%(ltime) %(proto) %(method) %(uri) %(proto) => %(status)"
@@ -41,6 +40,7 @@ def handle_serve_http(args):
     call_command('provide_accounts')
     call_command('check')
     port = args.port
+    TC = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE", 
args.config))
     if port is None:
         port = TC["bank"]["http_port"].value_int(required=True)
 
@@ -60,6 +60,7 @@ def handle_serve_uwsgi(args):
     call_command('migrate')
     call_command('provide_accounts')
     call_command('check')
+    TC = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE", 
args.config))
     serve_uwsgi = TC["bank"]["uwsgi_serve"].value_string(required=True).lower()
     params = ["uwsgi", "uwsgi",
               "--master",
diff --git a/talerbank/app/Makefile.am b/talerbank/app/Makefile.am
index b3efdd7..0af3d65 100644
--- a/talerbank/app/Makefile.am
+++ b/talerbank/app/Makefile.am
@@ -6,8 +6,8 @@ EXTRA_DIST = \
   urls.py \
   views.py \
   amount.py \
-  checks.py  \
   __init__.py \
   models.py \
   tests.py \
-  tests_alt.py
+  tests_alt.py \
+  middleware.py
diff --git a/talerbank/app/migrations/Makefile.am 
b/talerbank/app/migrations/Makefile.am
index ccbed84..c2817bd 100644
--- a/talerbank/app/migrations/Makefile.am
+++ b/talerbank/app/migrations/Makefile.am
@@ -1,5 +1,5 @@
 SUBDIRS = .
 
 EXTRA_DIST = \
-  0001_initial.py \
-  __init__.py
+0001_squashed_0013_remove_banktransaction_reimburses.py \
+__init__.py
diff --git a/talerbank/app/static/Makefile.am b/talerbank/app/static/Makefile.am
index 3b4f1cf..b393a6c 100644
--- a/talerbank/app/static/Makefile.am
+++ b/talerbank/app/static/Makefile.am
@@ -2,5 +2,5 @@ SUBDIRS = . web-common
 
 EXTRA_DIST = \
   favicon.ico \
-  chrome-store-link.js \
-  bank.css
+  bank.css \
+  disabled-button.css
diff --git a/talerbank/app/templates/base.html 
b/talerbank/app/templates/base.html
index fc33ca3..fe5fdcd 100644
--- a/talerbank/app/templates/base.html
+++ b/talerbank/app/templates/base.html
@@ -39,6 +39,7 @@
         <li><a href="{{ env('TALER_ENV_URL_BANK', '#') }}">Bank</a></li>
         <li><a href="{{ env('TALER_ENV_URL_MERCHANT_BLOG', '#') }}">Essay 
Shop</a></li>
         <li><a href="{{ env('TALER_ENV_URL_MERCHANT_DONATIONS', '#') 
}}">Donations</a></li>
+        <li><a href="{{ env('TALER_ENV_URL_MERCHANT_SURVEY', '#') 
}}">Tipping/Survey</a></li>
       </ul>
       <p>You can learn more about Taler on our main <a 
href="https://taler.net";>website</a>.</p>
     </div>
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 55686ce..2dd121e 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -48,6 +48,10 @@ class LoginFailed(Exception):
     hint = "Wrong username/password"
     http_status_code = 401
 
+class PrivateAccountException(Exception):
+    hint = "The selected account is private"
+    http_status_code = 402
+
 class DebitLimitException(Exception):
     hint = "Debit too high, operation forbidden."
     http_status_code = 403
@@ -346,7 +350,6 @@ def extract_history(account, delta=None, start=-1, 
sign="+"):
 
 
 def serve_public_accounts(request, name=None, page=None):
-    
     try:
         page = int(page)
     except Exception:
@@ -355,54 +358,28 @@ def serve_public_accounts(request, name=None, page=None):
     if not name:
         name = settings.TALER_PREDEFINED_ACCOUNTS[0]
     user = User.objects.get(username=name)
+    if not user.bankaccount.is_public:
+        raise PrivateAccountException("Can't display public history for 
private account")
 
-    if "public_history_count" not in request.session:
-        qs = extract_history(user.bankaccount, sign="-")
-        youngest = -1
-        if qs:
-            youngest = qs[0]["row_id"]
-        request.session["public_history_account"] = \
-            len(qs), youngest
+    num_records = query_history_raw(user.bankaccount, "both", start=-1, 
sign="-").count()
 
     DELTA = 30
-    youngest = request.session["public_history_account"][1]
-    # normalize page
-    if not page or page in [0, 1]:
-        page = 1
-    # page 0 and 1 give both the youngest 100 records.
-    if page > 1:
-        youngest = youngest - (DELTA * (page - 1)) # goes backwards.
-    if not user.bankaccount.is_public:
-        request.session["public_accounts_hint"] = \
-            True, False, "Could not query private accounts!"
-    fail_message, success_message, hint = \
-        get_session_hint(request, "public_accounts_hint")
-    public_accounts = BankAccount.objects.filter(is_public=True)
+    youngest = 1 + DELTA * (page - 1)
 
-    # Retrieve DELTA records older than 'start'.
-    history = extract_history(
-        user.bankaccount, DELTA,
-        -1 if youngest < 2 else youngest, "-")
+    public_accounts = BankAccount.objects.filter(is_public=True)
 
-    num_pages = max(
-        request.session["public_history_account"][0] / DELTA,
-        1) # makes sure pages[0] exists, below.
+    # Retrieve DELTA records, starting from 'youngest'
+    history = extract_history(user.bankaccount, DELTA, youngest - 1, "+")
 
-    pages = list(
-        range(max(1, page - 3),
-              # need +1 because the range is not inclusive for
-              # the upper limit.
-              min(page + 4, (math.ceil(num_pages) + 1))))
+    num_pages = max(num_records // DELTA, 1)
+    pages = list(range(1, num_pages + 1))
 
     context = dict(
         current_page=page,
-        back = page - 1 if pages[0] > 1 else None,
-        forth = page + 1 if pages[-1] < num_pages else None,
+        back = page - 1 if page > 1 else None,
+        forth = page + 1 if page < num_pages else None,
         public_accounts=public_accounts,
         selected_account=dict(
-            fail_message=fail_message,
-            success_message=success_message,
-            hint=hint,
             name=name,
             number=user.bankaccount.account_no,
             history=history,
@@ -411,6 +388,7 @@ def serve_public_accounts(request, name=None, page=None):
     )
     return render(request, "public_accounts.html", context)
 
+
 def login_via_headers(view_func):
     def _decorator(request, *args, **kwargs):
         user_account = auth_and_login(request)
@@ -436,15 +414,23 @@ def login_via_headers(view_func):
 #   than 'start'.
 
 def query_history(bank_account, direction, delta, start, sign):
+    qs = query_history_raw(bank_account, direction, start, sign)
+    # '-id' does descending ordering.
+    ordering = "-id" if sign in ["-", "*"] else "id"
+    return qs.order_by(ordering)[:delta]
+
+
+def query_history_raw(bank_account, direction, start, sign):
     direction_switch = {
-        "both": Q(debit_account=bank_account) \
-                | Q(credit_account=bank_account),
+        "both": (Q(debit_account=bank_account) |
+                 Q(credit_account=bank_account)),
         "credit": Q(credit_account=bank_account),
         "debit": Q(debit_account=bank_account),
-        "cancel+": Q(credit_account=bank_account) \
-                      & Q(cancelled=True),
-        "cancel-": Q(debit_account=bank_account) \
-                      & Q(cancelled=True)}
+        "cancel+": (Q(credit_account=bank_account) &
+                    Q(cancelled=True)),
+        "cancel-": (Q(debit_account=bank_account) &
+                    Q(cancelled=True)),
+    }
 
     sign_filter = {
         "+": Q(id__gt=start),
@@ -457,9 +443,8 @@ def query_history(bank_account, direction, delta, start, 
sign):
 
     return BankTransaction.objects.filter(
         direction_switch.get(direction),
-        sign_filter.get(sign)).order_by(
-            # '-id' does descending ordering.
-            "-id" if sign in ["-", "*"] else "id")[:delta]
+        sign_filter.get(sign));
+
 
 @require_GET
 @login_via_headers

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



reply via email to

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