gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-blog] branch master updated (eeb3919 -> 27414f7)


From: gnunet
Subject: [GNUnet-SVN] [taler-blog] branch master updated (eeb3919 -> 27414f7)
Date: Tue, 16 Jan 2018 13:27:17 +0100

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

dold pushed a change to branch master
in repository blog.

    from eeb3919  typo
     new bde9272  include resource url
     new 27414f7  no need for custom URL helpers

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 talerblog/blog/blog.py                 |  8 ++--
 talerblog/blog/templates/base.html     | 12 +++---
 talerblog/blog/templates/purchase.html | 41 ------------------
 talerblog/helpers.py                   | 79 ----------------------------------
 4 files changed, 9 insertions(+), 131 deletions(-)
 delete mode 100644 talerblog/blog/templates/purchase.html
 delete mode 100644 talerblog/helpers.py

diff --git a/talerblog/blog/blog.py b/talerblog/blog/blog.py
index 4cdb81d..9c88e81 100644
--- a/talerblog/blog/blog.py
+++ b/talerblog/blog/blog.py
@@ -29,7 +29,6 @@ import base64
 import requests
 import flask
 from talerblog.talerconfig import TalerConfig
-from ..helpers import make_url, join_urlparts
 from ..blog.content import ARTICLES, get_article_file, get_image_file
 
 
@@ -50,11 +49,9 @@ app.config.from_object(__name__)
 @app.context_processor
 def utility_processor():
     # These helpers will be available in templates
-    def url(my_url):
-        return join_urlparts(flask.request.script_root, my_url)
     def env(name, default=None):
         return os.environ.get(name, default)
-    return dict(url=url, env=env)
+    return dict(env=env)
 
 
 def err_abort(status_code, **params):
@@ -156,7 +153,7 @@ def article(article_name, data=None):
     if not order_id:
         order = dict(
             summary="Essay: " + article_name.replace("_", " "),
-            fulfillment_url=make_url("/essay/" + quote(article_name)),
+            fulfillment_url=flask.request.base_url,
             amount=ARTICLE_AMOUNT,
             instance=INSTANCE,
         )
@@ -167,6 +164,7 @@ def article(article_name, data=None):
     pay_params = dict(
         instance=INSTANCE,
         order_id=order_id,
+        ressource_url=flask.request.base_url,
         session_id=session_id,
         session_sig=session_sig,
     )
diff --git a/talerblog/blog/templates/base.html 
b/talerblog/blog/templates/base.html
index 755e72f..c21a082 100644
--- a/talerblog/blog/templates/base.html
+++ b/talerblog/blog/templates/base.html
@@ -18,11 +18,11 @@
 <html data-taler-nojs="true">
 <head>
   <title>Taler Donation Demo</title>
-  <link rel="stylesheet" type="text/css" href="{{ 
url('/static/web-common/pure.css') }}" />
-  <link rel="stylesheet" type="text/css" href="{{ 
url('/static/web-common/demo.css') }}" />
-  <link rel="stylesheet" type="text/css" href="{{ 
url('/static/web-common/taler-fallback.css') }}" id="taler-presence-stylesheet" 
/>
-  <script src="{{ url("/static/web-common/taler-wallet-lib.js") }}" 
type="application/javascript"></script>
-  <script src="{{ url("/static/web-common/lang.js") }}" 
type="application/javascript"></script>
+  <link rel="stylesheet" type="text/css" href="{{ url_for('static', 
'web-common/pure.css') }}" />
+  <link rel="stylesheet" type="text/css" href="{{ url_for('static', 
'web-common/demo.css') }}" />
+  <link rel="stylesheet" type="text/css" href="{{ url_for('static', 
'web-common/taler-fallback.css') }}" id="taler-presence-stylesheet" />
+  <script src="{{ url_for('static', 'web-common/taler-wallet-lib.js') }}" 
type="application/javascript"></script>
+  <script src="{{ url_for('static', 'web-common/lang.js') }}" 
type="application/javascript"></script>
   {% block styles %}{% endblock %}
   {% block scripts %}{% endblock %}
 </head>
@@ -43,7 +43,7 @@
   </div>
 
   <section id="main" class="content">
-    <a href="{{ url("/") }}">
+    <a href="{{ url_for('index') }}">
       <div id="logo">
         <svg height="100" width="100">
           <circle cx="50" cy="50" r="40" stroke="darkcyan" stroke-width="6" 
fill="white" />
diff --git a/talerblog/blog/templates/purchase.html 
b/talerblog/blog/templates/purchase.html
deleted file mode 100644
index d1baf38..0000000
--- a/talerblog/blog/templates/purchase.html
+++ /dev/null
@@ -1,41 +0,0 @@
-{% extends "templates/base.html" %}
-
-{% block main %}
-<meta name="hc" value="{{ hc }}">
-<meta name="pay_url" value="{{ pay_url|safe }}">
-<meta name="offering_url" value="{{ offering_url|safe }}">
-<meta name="contract_url" value="{{ contract_url|safe }}">
-<meta name="no_contract" value="{{ no_contract }}">
-<div id="ccfakeform" class="fade">
-  <p>
-  Oops, it looks like you don't have a Taler wallet installed.  Why don't you 
enter
-  all your credit card details before reading the article? <em>You can also
-  use GNU Taler to complete the purchase at any time.</em>
-  </p>
-
-  <form>
-    First name<br> <input type="text"></input><br>
-    Family name<br> <input type="text"></input><br>
-    Age<br> <input type="text"></input><br>
-    Nationality<br> <input type="text"></input><br>
-    Gender<br> <input type="radio" name"gender">Male</input>
-    CC number<br> <input type="text"></input><br>
-    <input type="radio" name="gender">Female</input><br>
-  </form>
-  <form method="get" action="/cc-payment/{{ article_name }}">
-    <input type="submit"></input>
-  </form>
-</div>
-
-<div id="talerwait">
-  <em>Processing payment with GNU Taler, please wait <span 
id="action-indicator"></span></em>
-</div>
-{% endblock main %}
-
-{% block body_prelude %}
-  <script src="{{ url('/static/body-prelude.js') }}" 
type="application/javascript"></script>
-{% endblock body_prelude %}
-
-{% block scripts %}
-  <script src="{{ url('/static/purchase.js') }}" 
type="application/javascript"></script>
-{% endblock scripts %}
diff --git a/talerblog/helpers.py b/talerblog/helpers.py
deleted file mode 100644
index 83eccd5..0000000
--- a/talerblog/helpers.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#  This file is part of TALER
-#  (C) 2016 INRIA
-#
-#  TALER is free software; you can redistribute it and/or modify it under the
-#  terms of the GNU Affero 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 Florian Dold
-#  @author Marcello Stanisci
-
-from urllib.parse import urljoin, urlencode
-import logging
-import json
-import flask
-from .talerconfig import TalerConfig
-
-LOGGER = logging.getLogger(__name__)
-
-TC = TalerConfig.from_env()
-BACKEND_URL = TC["frontends"]["backend"].value_string(required=True)
-NDIGITS = TC["frontends"]["NDIGITS"].value_int()
-CURRENCY = TC["taler"]["CURRENCY"].value_string()
-
-FRACTION_BASE = 1e8
-
-if not NDIGITS:
-    NDIGITS = 2
-
-class MissingParameterException(Exception):
-    def __init__(self, param):
-        self.param = param
-        super().__init__()
-
-def amount_to_float(amount):
-    return amount['value'] + (float(amount['fraction']) / float(FRACTION_BASE))
-
-
-def amount_from_float(floatx):
-    value = int(floatx)
-    fraction = int((floatx - value) * FRACTION_BASE)
-    return dict(currency=CURRENCY, value=value, fraction=fraction)
-
-
-def join_urlparts(*parts):
-    ret = ""
-    part = 0
-    while part < len(parts):
-        buf = parts[part]
-        part += 1
-        if ret.endswith("/"):
-            buf = buf.lstrip("/")
-        elif ret and not buf.startswith("/"):
-            buf = "/" + buf
-        ret += buf
-    return ret
-
-
-def make_url(page, *query_params):
-    """
-    Return a URL to a page in the current Flask application with the given
-    query parameters (sequence of key/value pairs).
-    """
-    query = urlencode(query_params)
-    if page.startswith("/"):
-        root = flask.request.url_root
-        page = page.lstrip("/")
-    else:
-        root = flask.request.base_url
-    url = urljoin(root, "%s?%s" % (page, query))
-    # urlencode is overly eager with quoting, the wallet right now
-    # needs some characters unquoted.
-    return url.replace("%24", "$").replace("%7B", "{").replace("%7D", "}")

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



reply via email to

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