Do not generate json by hand

This commit is contained in:
Yohan Boniface 2016-05-13 20:58:37 +02:00
parent 3cde7042a1
commit 5458bedd09

View file

@ -36,7 +36,12 @@ class StatsResource(object):
db.close() db.close()
standard_headers(resp) standard_headers(resp)
resp.body = """{"events_count": %s, "last_created": "%s", "last_updated": "%s"}""" % (stat[0], stat[1], stat[2]) body = {
"events_count": stat[0],
"last_created": stat[1],
"last_updated": stat[2]
}
resp.body = json.dumps(body)
resp.status = falcon.HTTP_200 resp.status = falcon.HTTP_200