Browse Source

Fix failing test: "AssertionError: 'application/javascript' != 'application/json'" in flask/testsuite/helpers.py", line 88

pull/514/head
Marc Abramowitz 13 years ago
parent
commit
447afc3525
  1. 10
      flask/helpers.py

10
flask/helpers.py

@ -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')

Loading…
Cancel
Save