You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/07/27 22:20:12 UTC

[04/22] allura git commit: [#7927] pass cache setting through; use str in headers

[#7927] pass cache setting through; use str in headers


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/82a3642b
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/82a3642b
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/82a3642b

Branch: refs/heads/hs/7925
Commit: 82a3642b3c36839e7fcbbc9ebce43fad4eb6a531
Parents: 6625703
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Jul 21 17:42:55 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jul 21 17:44:31 2015 +0000

----------------------------------------------------------------------
 Allura/allura/config/middleware.py      | 2 +-
 Allura/allura/lib/custom_middleware.py  | 2 +-
 Allura/allura/tests/test_middlewares.py | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/82a3642b/Allura/allura/config/middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/middleware.py b/Allura/allura/config/middleware.py
index 922034d..6c39d4b 100644
--- a/Allura/allura/config/middleware.py
+++ b/Allura/allura/config/middleware.py
@@ -143,7 +143,7 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
         allowed_methods = aslist(config.get('cors.methods'))
         allowed_headers = aslist(config.get('cors.headers'))
         cache_duration = asint(config.get('cors.cache_duration', 0))
-        app = CORSMiddleware(app, allowed_methods, allowed_headers)
+        app = CORSMiddleware(app, allowed_methods, allowed_headers, cache_duration)
     # Setup the allura SOPs
     app = allura_globals_middleware(app)
     # Ensure http and https used per config

http://git-wip-us.apache.org/repos/asf/allura/blob/82a3642b/Allura/allura/lib/custom_middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index 4eef689..e56a530 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -133,7 +133,7 @@ class CORSMiddleware(object):
             ])
             if self.cache_preflight:
                 headers.append(
-                    ('Access-Control-Max-Age', self.cache_preflight)
+                    ('Access-Control-Max-Age', str(self.cache_preflight))
                 )
         return headers
 

http://git-wip-us.apache.org/repos/asf/allura/blob/82a3642b/Allura/allura/tests/test_middlewares.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_middlewares.py b/Allura/allura/tests/test_middlewares.py
index 1ca6d8a..4b45097 100644
--- a/Allura/allura/tests/test_middlewares.py
+++ b/Allura/allura/tests/test_middlewares.py
@@ -95,7 +95,7 @@ class TestCORSMiddleware(object):
                      [('Access-Control-Allow-Origin', '*'),
                       ('Access-Control-Allow-Methods', 'GET, PUT'),
                       ('Access-Control-Allow-Headers', 'accept'),
-                      ('Access-Control-Max-Age', 86400)])
+                      ('Access-Control-Max-Age', '86400')])
 
     def test_get_access_control_request_headers(self):
         key = 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS'