diff options
| -rw-r--r-- | CHANGES.txt | 3 | ||||
| -rw-r--r-- | pyramid/renderers.py | 2 | ||||
| -rw-r--r-- | pyramid/tests/test_renderers.py | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 9f780fe45..c05c4561e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -51,6 +51,9 @@ Features Bug Fixes --------- +- Add a trailing semicolon to the JSONP response. This fixes JavaScript syntax + errors for old IE versions. + - Fix the ``pcreate`` script so that when the target directory name ends with a slash it does not produce a non-working project directory structure. Previously saying ``pcreate -s starter /foo/bar/`` produced different output diff --git a/pyramid/renderers.py b/pyramid/renderers.py index e90d07b38..88ef285a0 100644 --- a/pyramid/renderers.py +++ b/pyramid/renderers.py @@ -363,7 +363,7 @@ class JSONP(JSON): body = val else: ct = 'application/javascript' - body = '%s(%s)' % (callback, val) + body = '%s(%s);' % (callback, val) response = request.response if response.content_type == response.default_content_type: response.content_type = ct diff --git a/pyramid/tests/test_renderers.py b/pyramid/tests/test_renderers.py index f6b9d2b0d..2bddd2318 100644 --- a/pyramid/tests/test_renderers.py +++ b/pyramid/tests/test_renderers.py @@ -567,7 +567,7 @@ class TestJSONP(unittest.TestCase): request = testing.DummyRequest() request.GET['callback'] = 'callback' result = renderer({'a':'1'}, {'request':request}) - self.assertEqual(result, 'callback({"a": "1"})') + self.assertEqual(result, 'callback({"a": "1"});') self.assertEqual(request.response.content_type, 'application/javascript') |
