Merge pull request #515 from msabramo/travis

Travis
This commit is contained in:
Kenneth Reitz 2012-05-29 17:04:23 -07:00
commit 9f055104ad
2 changed files with 18 additions and 3 deletions

11
.travis.yml Normal file
View file

@ -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 file

@ -133,13 +133,17 @@ def jsonify(*args, **kwargs):
"""
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']
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')