diff options
| author | Chris McDonough <chrism@plope.com> | 2013-12-12 15:50:28 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2013-12-12 15:50:28 -0500 |
| commit | 0805d22ed951752a56d96e13384065bfafa2a315 (patch) | |
| tree | a45a84082f36a8795341cf5471c1368e5cccf975 | |
| parent | 28c26c17d66b563140e60b95ca1ea7e6dc3ccb6c (diff) | |
| parent | 3c95b1af3661618490e6a3789fd80755924e7d18 (diff) | |
| download | pyramid-0805d22ed951752a56d96e13384065bfafa2a315.tar.gz pyramid-0805d22ed951752a56d96e13384065bfafa2a315.tar.bz2 pyramid-0805d22ed951752a56d96e13384065bfafa2a315.zip | |
Merge branch 'jsonp-syntax' of github.com:wichert/pyramid into wichert-jsonp-syntax
| -rw-r--r-- | CHANGES.txt | 3 | ||||
| -rw-r--r-- | docs/narr/commandline.rst | 12 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/src/views/tutorial/views.py | 5 | ||||
| -rw-r--r-- | pyramid/renderers.py | 2 | ||||
| -rw-r--r-- | pyramid/tests/test_renderers.py | 2 |
5 files changed, 14 insertions, 10 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 8ca6e7e9b..1ae2ebbd9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -74,6 +74,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/docs/narr/commandline.rst b/docs/narr/commandline.rst index 0984b4daf..3cabbd8f4 100644 --- a/docs/narr/commandline.rst +++ b/docs/narr/commandline.rst @@ -387,12 +387,12 @@ explicit tweens defined in its ``development.ini`` file: Implicit Tween Chain (not used) - Position Name Alias - -------- ---- ----- - - - INGRESS - 0 pyramid_debugtoolbar.toolbar.toolbar_tween_factory pdbt - 1 pyramid.tweens.excview_tween_factory excview - - - MAIN + Position Name + -------- ---- + - INGRESS + 0 pyramid_debugtoolbar.toolbar.toolbar_tween_factory + 1 pyramid.tweens.excview_tween_factory + - MAIN Here's the application configuration section of the ``development.ini`` used by the above ``ptweens`` command which reports that the explicit tween chain diff --git a/docs/tutorials/wiki2/src/views/tutorial/views.py b/docs/tutorials/wiki2/src/views/tutorial/views.py index 42ef77b98..b41d4ab40 100644 --- a/docs/tutorials/wiki2/src/views/tutorial/views.py +++ b/docs/tutorials/wiki2/src/views/tutorial/views.py @@ -1,3 +1,4 @@ +import cgi import re from docutils.core import publish_parts @@ -32,10 +33,10 @@ def view_page(request): exists = DBSession.query(Page).filter_by(name=word).all() if exists: view_url = request.route_url('view_page', pagename=word) - return '<a href="%s">%s</a>' % (view_url, word) + return '<a href="%s">%s</a>' % (view_url, cgi.escape(word)) else: add_url = request.route_url('add_page', pagename=word) - return '<a href="%s">%s</a>' % (add_url, word) + return '<a href="%s">%s</a>' % (add_url, cgi.escape(word)) content = publish_parts(page.data, writer_name='html')['html_body'] content = wikiwords.sub(check, content) 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') |
