aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-11-19 08:20:56 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-11-19 08:20:56 +0100
commit17cbf5594777c309135a91a871c925b03a2c5046 (patch)
tree9e09947fb975f2f18a80d2187ea6099b5ad19366
parentsimplification (diff)
downloadnewspipe-17cbf5594777c309135a91a871c925b03a2c5046.tar.gz
newspipe-17cbf5594777c309135a91a871c925b03a2c5046.tar.bz2
newspipe-17cbf5594777c309135a91a871c925b03a2c5046.zip
Add a way to get the json encoded by jquery in the URL when using the GET method.
-rw-r--r--pyaggr3g470r/views/api/common.py9
-rwxr-xr-xrunserver.py2
2 files changed, 9 insertions, 2 deletions
diff --git a/pyaggr3g470r/views/api/common.py b/pyaggr3g470r/views/api/common.py
index 8083cb4c..ea5172c2 100644
--- a/pyaggr3g470r/views/api/common.py
+++ b/pyaggr3g470r/views/api/common.py
@@ -161,12 +161,19 @@ class PyAggResourceMulti(PyAggAbstractResource):
"""retrieve several objects. filters can be set in the payload on the
different fields of the object, and a limit can be set in there as well
"""
+ args = None
+ args = [item[0] for item in request.args.items()]
+ args = json.loads(args[0])
+
try:
limit = request.json.pop('limit', 10)
order_by = request.json.pop('order_by', None)
query = self.controller.read(**request.json)
except:
- limit, order_by, query = 10, None, self.controller.read()
+ if None is not args:
+ limit, order_by, query = 10, None, self.controller.read(**args)
+ else:
+ limit, order_by, query = 10, None, self.controller.read()
if order_by:
query = query.order_by(order_by)
if limit:
diff --git a/runserver.py b/runserver.py
index ccd8bc60..cda0e06f 100755
--- a/runserver.py
+++ b/runserver.py
@@ -57,4 +57,4 @@ with application.app_context():
if __name__ == '__main__':
application.run(host=conf.WEBSERVER_HOST,
port=conf.WEBSERVER_PORT,
- debug=conf.LOG_LEVEL <= logging.DEBUG)
+ debug=True)
bgstack15