From 4a9ee3fe62f993a8a8c5247d2d8b505a1c266b1e Mon Sep 17 00:00:00 2001 From: JackDandy Date: Tue, 28 Apr 2015 17:42:13 +0100 Subject: [PATCH] Update fix for API response header for JSON content type and the return of JSONP data to updated package as listed in hacks.txt. --- CHANGES.md | 1 + tornado/web.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 4a597fac..9f452a12 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ * Update Tornado webserver to 4.2.dev1 (609dbb9) * Update change to suppress reporting of Tornado exception error 1 to updated package as listed in hacks.txt +* Update fix for API response header for JSON content type and the return of JSONP data to updated package as listed in hacks.txt * Change network names to only display on top line of Day by Day layout on Episode View * Reposition country part of network name into the hover over in Day by Day layout * Add ToTV provider diff --git a/tornado/web.py b/tornado/web.py index 9bc12933..d8afbe8a 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -694,7 +694,10 @@ class RequestHandler(object): message += ". Lists not accepted for security reasons; see http://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.write" raise TypeError(message) if isinstance(chunk, dict): - chunk = escape.json_encode(chunk) + if 'unwrap_json' in chunk: + chunk = chunk['unwrap_json'] + else: + chunk = escape.json_encode(chunk) self.set_header("Content-Type", "application/json; charset=UTF-8") chunk = utf8(chunk) self._write_buffer.append(chunk)