Mercurial > p > roundup > code
diff roundup/rest.py @ 5636:528b902f98fc
Make pretty print mode the default. Turn off using pretty=false. This
makes use by humans (e.g. in browser) or printing when debugging
easier. With gzip and other compression the extra whitespace is not a
major issue.
Idea from:
https://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#pretty-print-gzip
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 07 Mar 2019 18:08:32 -0500 |
| parents | a29a8dae2095 |
| children | 7e3cceec3f4f |
line wrap: on
line diff
--- a/roundup/rest.py Thu Mar 07 15:32:25 2019 +0100 +++ b/roundup/rest.py Thu Mar 07 18:08:32 2019 -0500 @@ -1306,9 +1306,9 @@ # check for pretty print try: - pretty_output = input['pretty'].value.lower() == "true" + pretty_output = not input['pretty'].value.lower() == "false" except KeyError: - pretty_output = False + pretty_output = True # add access-control-allow-* to support CORS self.client.setHeader("Access-Control-Allow-Origin", "*")
