gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant-frontends] branch master updated: JS sends


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant-frontends] branch master updated: JS sends timetamp to /history now. No parameters manipulation server-side.
Date: Tue, 28 Feb 2017 20:48:58 +0100

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

marcello pushed a commit to branch master
in repository merchant-frontends.

The following commit(s) were added to refs/heads/master by this push:
     new 11a869a  JS sends timetamp to /history now.  No parameters 
manipulation server-side.
11a869a is described below

commit 11a869aacf58018ad6b170b57b8f45e0e1313fcf
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Feb 28 20:48:03 2017 +0100

    JS sends timetamp to /history now.  No parameters manipulation
    server-side.
---
 talerfrontends/blog/blog.py                | 18 ++++++++----------
 talerfrontends/blog/static/backoffice.js   |  8 ++++----
 talerfrontends/blog/static/web-common      |  2 +-
 talerfrontends/donations/static/web-common |  2 +-
 talerfrontends/helpers.py                  |  2 ++
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/talerfrontends/blog/blog.py b/talerfrontends/blog/blog.py
index 118e3d4..bfc9c9b 100644
--- a/talerfrontends/blog/blog.py
+++ b/talerfrontends/blog/blog.py
@@ -21,7 +21,7 @@ Implement URL handlers and payment logic for the blog 
merchant.
 """
 
 import flask
-from urllib.parse import urljoin, urlencode, quote
+from urllib.parse import urljoin, urlencode, quote, parse_qsl, urlsplit
 import requests
 import logging
 import os
@@ -33,7 +33,8 @@ import datetime
 from pprint import pprint
 from talerfrontends.talerconfig import TalerConfig
 from talerfrontends.helpers import (make_url,
-expect_parameter, expect_parameter_int, join_urlparts)
+expect_parameter, expect_parameter_int, join_urlparts,
+get_query_string)
 from talerfrontends.errors import (TrackNotReadyError,
 MalformedParameterError, BackendError)
 from talerfrontends.blog.content import (articles,
@@ -159,15 +160,12 @@ def pay():
 
 @app.route("/history")
 def history():
-    days = expect_parameter_int("days")
-    instance = expect_parameter("instance")
-    date = datetime.datetime.fromtimestamp(0)
-    if 0 != days:
-        now = datetime.date.today()
-        d = datetime.timedelta(days=days)
-        date = now - d
+    # FIXME now JS needs to give a *timestamp*, NOT
+    # days anymore..
+    qs = get_query_string()
     url = urljoin(BACKEND_URL, "history")
-    r = requests.get(url, params=dict(date=date.strftime("%s"), 
instance=instance))
+    logger.info("Echoing parameters, '%s'" % qs)
+    r = requests.get(url, params=dict(parse_qsl(urlsplit(url).query)))
     if r.status_code != 200:
         logger.error("failed to GET to '%s'", url)
         raise BackendError(r.status_code, r.text)
diff --git a/talerfrontends/blog/static/backoffice.js 
b/talerfrontends/blog/static/backoffice.js
index 7ddc264..2b0ee59 100644
--- a/talerfrontends/blog/static/backoffice.js
+++ b/talerfrontends/blog/static/backoffice.js
@@ -28,7 +28,7 @@
 "use strict";
 
 var FRACTION = 100000000;
-var DAYS = 10;
+var TIMESTAMP = 0;
 var START = 0;
 var INSTANCE = "FSF";
 
@@ -135,11 +135,11 @@ function fill_table(history){
 }
 
 function get_more_history(){
-  DAYS += 10;
+  /*FIXME: do add one week to TIMESTAMP*/
   START += 20;
 
   var req = new XMLHttpRequest();
-  req.open("GET", `/history?days=${DAYS}&instance=${INSTANCE}&start=${START}`, 
true);
+  req.open("GET", 
`/history?timestamp=${TIMESTAMP}&instance=${INSTANCE}&start=${START}`, true);
   req.onload = function(){
     if(req.readyState == 4 && req.status == 200){
       var history = JSON.parse(req.responseText); 
@@ -161,7 +161,7 @@ function get_more_history(){
 function get_history(){
 
   var req = new XMLHttpRequest();
-  req.open("GET", `/history?days=${DAYS}&instance=${INSTANCE}`, true);
+  req.open("GET", `/history?timestamp=${TIMESTAMP}&instance=${INSTANCE}`, 
true);
   req.onload = function(){
     if(req.readyState == 4 && req.status == 200){
       var history = JSON.parse(req.responseText); 
diff --git a/talerfrontends/blog/static/web-common 
b/talerfrontends/blog/static/web-common
index 0be9ac9..aae7c0a 160000
--- a/talerfrontends/blog/static/web-common
+++ b/talerfrontends/blog/static/web-common
@@ -1 +1 @@
-Subproject commit 0be9ac9264a3bd9f495c37abf1ac864562e8c598
+Subproject commit aae7c0a87a9ff1640c3cd72dd4df0ac590f8b0e4
diff --git a/talerfrontends/donations/static/web-common 
b/talerfrontends/donations/static/web-common
index 0be9ac9..aae7c0a 160000
--- a/talerfrontends/donations/static/web-common
+++ b/talerfrontends/donations/static/web-common
@@ -1 +1 @@
-Subproject commit 0be9ac9264a3bd9f495c37abf1ac864562e8c598
+Subproject commit aae7c0a87a9ff1640c3cd72dd4df0ac590f8b0e4
diff --git a/talerfrontends/helpers.py b/talerfrontends/helpers.py
index 9ed79bd..774efc4 100644
--- a/talerfrontends/helpers.py
+++ b/talerfrontends/helpers.py
@@ -150,6 +150,8 @@ def expect_parameter_int(name):
         raise MalformedParameterError(name)
     return v
 
+def get_query_string():
+    return request.query_string
 
 def expect_form(name):
     value = request.form.get(name, None)

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



reply via email to

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