Chris McDonough
2013-12-12 0805d22ed951752a56d96e13384065bfafa2a315
Merge branch 'jsonp-syntax' of github.com:wichert/pyramid into wichert-jsonp-syntax
5 files modified
24 ■■■■■ changed files
CHANGES.txt 3 ●●●●● patch | view | raw | blame | history
docs/narr/commandline.rst 12 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/views/tutorial/views.py 5 ●●●●● patch | view | raw | blame | history
pyramid/renderers.py 2 ●●● patch | view | raw | blame | history
pyramid/tests/test_renderers.py 2 ●●● patch | view | raw | blame | history
CHANGES.txt
@@ -74,6 +74,9 @@
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 
docs/narr/commandline.rst
@@ -387,12 +387,12 @@
   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
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 @@
        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)
pyramid/renderers.py
@@ -363,7 +363,7 @@
                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
pyramid/tests/test_renderers.py
@@ -567,7 +567,7 @@
        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')