From 3f2c5d94296de61648c6c84503b6d1f2ceac6db7 Mon Sep 17 00:00:00 2001 From: Christian Quest Date: Sun, 8 May 2016 11:56:56 +0200 Subject: [PATCH] minimal formatting for featurecollections --- backend.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend.py b/backend.py index 94519df..98c1dd6 100644 --- a/backend.py +++ b/backend.py @@ -47,7 +47,10 @@ SELECT format('{"type":"Feature", "id": "'|| events_id::text ||'", "properties": FROM events JOIN geo ON (hash=events_geo)"""); standard_headers(resp) - resp.body = '{"type": "FeatureCollection","features": ['+','.join([x[0] for x in cur.fetchall()])+']}' + resp.body = """{"type": "FeatureCollection","features": [ +"""+""", +""".join([x[0] for x in cur.fetchall()])+""" +]}""" resp.status = falcon.HTTP_200 class EventResource(object): @@ -108,7 +111,10 @@ SELECT '{"type":"Feature", "properties": '|| (events_tags::jsonb || jsonb_build_ ORDER BY createdate DESC LIMIT 50; """) - resp.body = '{"type": "FeatureCollection","features": ['+','.join([x[0] for x in cur.fetchall()])+']}' + resp.body = """{"type":"FeatureCollection", "features": [ +"""+""", +""".join([x[0] for x in cur.fetchall()])+""" +]}""" resp.status = falcon.HTTP_200 else: # get single event geojson Feature by id