plugins/api: fix for cross origin requests
authorRunar Petursson <runar@betur.com>
Fri, 15 Feb 2013 02:17:24 +0000 (10:17 +0800)
committerJoar Wandborg <joar@wandborg.se>
Wed, 20 Feb 2013 22:41:36 +0000 (23:41 +0100)
The response headers were never getting set because of a bug in the 7c552c0
commit.  This expands the loop into a more readable form and results in the
headers getting set.

mediagoblin/plugins/api/tools.py

index e58782581fd6e72a4b6628dfc35b9cd069b17629..92411f4b894b8e9a421f5da3c4a1c1537dbad49d 100644 (file)
@@ -69,7 +69,8 @@ def json_response(serializable, _disable_cors=False, *args, **kw):
                 'Access-Control-Allow-Origin': '*',
                 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
                 'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With'}
-        (response.headers.set(key, value) for key, value in cors_headers)
+        for key, value in cors_headers.iteritems():
+            response.headers.set(key, value)
 
     return response