Browse Source

Merge pull request #515 from msabramo/travis

Travis
pull/517/head
Kenneth Reitz 13 years ago
parent
commit
9f055104ad
  1. 11
      .travis.yml
  2. 10
      flask/helpers.py

11
.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
flask/helpers.py

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

Loading…
Cancel
Save