diff options
author | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-08-20 12:21:13 -0400 |
---|---|---|
committer | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-08-20 12:21:13 -0400 |
commit | 9e204e49c9670b0e004dc9b62bf3b698b7534325 (patch) | |
tree | 452eab56add0e1b009b665f5b32d7b59b7545e82 /mediagoblin/plugins/api/tools.py | |
parent | e1561d048815e29b3b7c7e1c860d9cf0c4326f0a (diff) | |
parent | c62d174437445565b55b220396e7571a323a159c (diff) | |
download | mediagoblin-9e204e49c9670b0e004dc9b62bf3b698b7534325.tar.lz mediagoblin-9e204e49c9670b0e004dc9b62bf3b698b7534325.tar.xz mediagoblin-9e204e49c9670b0e004dc9b62bf3b698b7534325.zip |
Merge branch 'master' into OPW-Moderation-Update
Conflicts:
mediagoblin/db/models.py
mediagoblin/decorators.py
mediagoblin/routing.py
mediagoblin/user_pages/views.py
Diffstat (limited to 'mediagoblin/plugins/api/tools.py')
-rw-r--r-- | mediagoblin/plugins/api/tools.py | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/mediagoblin/plugins/api/tools.py b/mediagoblin/plugins/api/tools.py index 92411f4b..d1b3ebb1 100644 --- a/mediagoblin/plugins/api/tools.py +++ b/mediagoblin/plugins/api/tools.py @@ -51,30 +51,6 @@ class Auth(object): def __call__(self, request, *args, **kw): raise NotImplemented() - -def json_response(serializable, _disable_cors=False, *args, **kw): - ''' - Serializes a json objects and returns a werkzeug Response object with the - serialized value as the response body and Content-Type: application/json. - - :param serializable: A json-serializable object - - Any extra arguments and keyword arguments are passed to the - Response.__init__ method. - ''' - response = Response(json.dumps(serializable), *args, content_type='application/json', **kw) - - if not _disable_cors: - cors_headers = { - 'Access-Control-Allow-Origin': '*', - 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS', - 'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With'} - for key, value in cors_headers.iteritems(): - response.headers.set(key, value) - - return response - - def get_entry_serializable(entry, urlgen): ''' Returns a serializable dict() of a MediaEntry instance. |