diff options
| author | Tom Christie | 2014-12-03 23:14:58 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-03 23:14:58 +0000 |
| commit | f74e52b31ee7645e032e684855fc1ca2860d75f6 (patch) | |
| tree | 02ac4a1680a1080353f3f63854f11ad6968c00a5 /rest_framework | |
| parent | 6369f9212588c849c0ade41c135d229bfbe4a5cf (diff) | |
| parent | fe745b96163282e492f17a6b003418b81350333f (diff) | |
| download | django-rest-framework-f74e52b31ee7645e032e684855fc1ca2860d75f6.tar.bz2 | |
Merge
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/renderers.py | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index dd49ae82..e8caa40f 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -103,40 +103,6 @@ class JSONRenderer(BaseRenderer): return ret -class JSONPRenderer(JSONRenderer): - """ - Renderer which serializes to json, - wrapping the json output in a callback function. - """ - - media_type = 'application/javascript' - format = 'jsonp' - callback_parameter = 'callback' - default_callback = 'callback' - charset = 'utf-8' - - def get_callback(self, renderer_context): - """ - Determine the name of the callback to wrap around the json output. - """ - request = renderer_context.get('request', None) - params = request and request.query_params or {} - return params.get(self.callback_parameter, self.default_callback) - - def render(self, data, accepted_media_type=None, renderer_context=None): - """ - Renders into jsonp, wrapping the json output in a callback function. - - Clients may set the callback function name using a query parameter - on the URL, for example: ?callback=exampleCallbackName - """ - renderer_context = renderer_context or {} - callback = self.get_callback(renderer_context) - json = super(JSONPRenderer, self).render(data, accepted_media_type, - renderer_context) - return callback.encode(self.charset) + b'(' + json + b');' - - class YAMLRenderer(BaseRenderer): """ Renderer which serializes to YAML. |
