Skip to content

Commit

Permalink
Merge pull request #515 from msabramo/travis
Browse files Browse the repository at this point in the history
Travis
  • Loading branch information
Kenneth Reitz committed May 30, 2012
2 parents 086348e + 2c8cbeb commit 9f05510
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
@@ -0,0 +1,11 @@
language: python

python:
- 2.5
- 2.6
- 2.7
- pypy

before_install: pip install simplejson

script: python setup.py test
10 changes: 7 additions & 3 deletions flask/helpers.py
Expand Up @@ -133,13 +133,17 @@ def get_current_user():
""" """
if __debug__: if __debug__:
_assert_have_json() _assert_have_json()

padded = kwargs.get('padded', False)
if 'padded' in kwargs: if 'padded' in kwargs:
if isinstance(kwargs['padded'], str): del kwargs['padded']
callback = request.args.get(kwargs['padded']) or 'jsonp'

This comment has been minimized.

Copy link
@dnicolodi

dnicolodi Jun 12, 2012

I think

padded = kwargs.pop('padded', False)

is a better form for the above.

if padded:
if isinstance(padded, str):
callback = request.args.get(padded) or 'jsonp'
else: else:
callback = request.args.get('callback') or \ callback = request.args.get('callback') or \
request.args.get('jsonp') or 'jsonp' request.args.get('jsonp') or 'jsonp'
del kwargs['padded']
json_str = json.dumps(dict(*args, **kwargs), indent=None) json_str = json.dumps(dict(*args, **kwargs), indent=None)
content = str(callback) + "(" + json_str + ")" content = str(callback) + "(" + json_str + ")"
return current_app.response_class(content, mimetype='application/javascript') return current_app.response_class(content, mimetype='application/javascript')
Expand Down

2 comments on commit 9f05510

@mitsuhiko
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

@kennethreitz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍰

Please sign in to comment.