Permalink
Browse files

Merge pull request #515 from msabramo/travis

Travis
  • Loading branch information...
2 parents 086348e + 2c8cbeb commit 9f055104ad1a8bfa29c8cccf830dea196b5a9344 @kennethreitz kennethreitz committed May 30, 2012
Showing with 18 additions and 3 deletions.
  1. +11 −0 .travis.yml
  2. +7 −3 flask/helpers.py
View
@@ -0,0 +1,11 @@
+language: python
+
+python:
+ - 2.5
+ - 2.6
+ - 2.7
+ - pypy
+
+before_install: pip install simplejson
+
+script: python setup.py test
View
@@ -133,13 +133,17 @@ def get_current_user():
"""
if __debug__:
_assert_have_json()
+
+ padded = kwargs.get('padded', False)
if 'padded' in kwargs:
- if isinstance(kwargs['padded'], str):
- callback = request.args.get(kwargs['padded']) or 'jsonp'
+ del kwargs['padded']
+
@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:
callback = request.args.get('callback') or \
request.args.get('jsonp') or 'jsonp'
- del kwargs['padded']
json_str = json.dumps(dict(*args, **kwargs), indent=None)
content = str(callback) + "(" + json_str + ")"
return current_app.response_class(content, mimetype='application/javascript')

2 comments on commit 9f05510

Owner

mitsuhiko replied Jun 1, 2012

\o/

Contributor

kennethreitz replied Jun 1, 2012

🍰

Please sign in to comment.