Browse Source

Clean up docs and review pull request #384

Spelunking through the issues at the PyCon sprints.
pull/437/head
Ned Jackson Lovely 13 years ago
parent
commit
09370c3f1c
  1. 19
      flask/helpers.py

19
flask/helpers.py

@ -119,15 +119,16 @@ def jsonify(*args, **kwargs):
.. versionadded:: 0.2 .. versionadded:: 0.2
.. versionadded:: 0.9 .. versionadded:: 0.9
If the argument ``padded`` true than the json object will pad for If the ``padded`` argument is true, the JSON object will be padded
JSONP calls like from jquery. The response mimetype will also change for JSONP calls and the response mimetype will be changed to
to ``text/javascript``. ``text/javascript``. By default, the request arguments ``callback``
and ``jsonp`` will be used as the name for the callback function.
The json object will pad as javascript function with the function name This will work with jQuery and most other JavaScript libraries
from the request argument ``callback`` or ``jsonp``. If the argument by default.
``padded`` a string jsonify will look for the function name in the
request argument with the name which is equal to ``padded``. Is there If the ``padded`` argument is a string, jsonify will look for
no function name it will fallback and use ``jsonp`` as function name. the request argument with the same name and use that value as the
callback-function name.
""" """
if __debug__: if __debug__:
_assert_have_json() _assert_have_json()

Loading…
Cancel
Save