summaryrefslogtreecommitdiff
path: root/meta-phosphor/recipes-devtools/python/python-bottle/json-format.patch
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2018-08-31 13:25:51 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-09-06 14:44:12 +0300
commitff075f6ee795a590b244d70a90cc312ba1f2d83d (patch)
treea617790bdbfdeef960665ba0242e1f0c93e5301a /meta-phosphor/recipes-devtools/python/python-bottle/json-format.patch
parent3e4da38c127bb7e7641adc2fc41f4c33744cb918 (diff)
downloadopenbmc-ff075f6ee795a590b244d70a90cc312ba1f2d83d.tar.xz
meta-phosphor: Move layer content from common/
Adopt a more conventional directory hierarchy. meta-phosphor is still a _long_ way from suitable for hosting on yoctoproject.org but things like this don't help. (From meta-phosphor rev: 471cfcefa74b8c7ceb704cb670e6d915cf27c63b) Change-Id: I3f106b2f6cdc6cec734be28a6090800546f362eb Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-phosphor/recipes-devtools/python/python-bottle/json-format.patch')
-rw-r--r--meta-phosphor/recipes-devtools/python/python-bottle/json-format.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/meta-phosphor/recipes-devtools/python/python-bottle/json-format.patch b/meta-phosphor/recipes-devtools/python/python-bottle/json-format.patch
new file mode 100644
index 0000000000..9e754a996e
--- /dev/null
+++ b/meta-phosphor/recipes-devtools/python/python-bottle/json-format.patch
@@ -0,0 +1,31 @@
+Index: bottle-0.12.9/bottle.py
+===================================================================
+--- bottle-0.12.9.orig/bottle.py
++++ bottle-0.12.9/bottle.py
+@@ -1721,8 +1721,10 @@ class JSONPlugin(object):
+ name = 'json'
+ api = 2
+
+- def __init__(self, json_dumps=json_dumps):
++ def __init__(self, json_dumps=json_dumps, **kw):
+ self.json_dumps = json_dumps
++ self.json_kw = { x:y for x,y in kw.iteritems() \
++ if x in ['indent','sort_keys'] }
+
+ def apply(self, callback, route):
+ dumps = self.json_dumps
+@@ -1735,12 +1737,12 @@ class JSONPlugin(object):
+
+ if isinstance(rv, dict):
+ #Attempt to serialize, raises exception on failure
+- json_response = dumps(rv)
++ json_response = dumps(rv, **self.json_kw)
+ #Set content type only if serialization succesful
+ response.content_type = 'application/json'
+ return json_response
+ elif isinstance(rv, HTTPResponse) and isinstance(rv.body, dict):
+- rv.body = dumps(rv.body)
++ rv.body = dumps(rv.body, **self.json_kw)
+ rv.content_type = 'application/json'
+ return rv
+