padded attribute on jsonify not functioning as expected #495

Closed
codehugger opened this Issue Apr 20, 2012 · 3 comments

Comments

Projects
None yet
3 participants

When calling jsonify with the padded argument as True the expected behavior is padded JSON response that uses the callback argument. Example

handleResponse({"foo": "bar"})

However when setting padded to False the result is still a padded JSON response with the name of the callback function set to jsonp. Example

jsonp({"foo": "bar"})

Should be

{"foo": "bar"}

I added a quick fix for this issue at https://github.com/BeStillAsBright/flask/tree/issue495 but I must admit I'm new to contributing on github so I don't exactly know the proper procedures for this kind of thing.

Contributor

rduplain commented Apr 21, 2012

@BeStillAsBright the preferred method for contributing is using GitHub pull requests:

http://help.github.com/send-pull-requests/

The fix in b5fc0c3266a45f8b25260360518b2eac2d4eef34 does not handle the case where padded is a string argument. Reviewing this further, I'd like to confirm on the Flask team that the padded API for the jsonify function is what we want. In the current implementation, padded can be a boolean or a string, and that string points to the URL query argument which supplies the function name.

This is a feature added in 0.9-dev, and is not yet fully released. I added a test to make sure we fix this issue before release. If we change the jsonify padded behavior, I'll send an announcement to the mailing list.

@jfinkels jfinkels added a commit to jfinkels/flask that referenced this issue Apr 26, 2012

@jfinkels jfinkels Fixes issue #495. f5b45b6
Contributor

rduplain commented May 8, 2012

JSONP removed from Flask core in favor of an extension. See #502.

rduplain closed this May 8, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment