incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [9/9] git commit: [#6942] separate etag and last_modified params in serve_file
Date Mon, 16 Dec 2013 17:59:04 GMT
[#6942] separate etag and last_modified params in serve_file


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

Branch: refs/heads/master
Commit: c42080e4fe28093e57040117c2eb5a09bae47e9a
Parents: 746a362
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Mon Dec 16 17:11:39 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Mon Dec 16 17:58:46 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/static.py | 2 +-
 Allura/allura/lib/utils.py          | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c42080e4/Allura/allura/controllers/static.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/static.py b/Allura/allura/controllers/static.py
index 53b8be5..dd8c37f 100644
--- a/Allura/allura/controllers/static.py
+++ b/Allura/allura/controllers/static.py
@@ -49,4 +49,4 @@ class NewForgeController(object):
         """
         css, md5 = g.tool_icon_css
         return utils.serve_file(StringIO(css), 'tool_icon_css', 'text/css',
-                last_modified=md5)
+                etag=md5)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c42080e4/Allura/allura/lib/utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index 3e92f46..d35b17e 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -478,10 +478,12 @@ def take_while_true(source):
         x = source()
 
 
-def serve_file(fp, filename, content_type, last_modified=None, cache_expires=None, size=None,
embed=True):
+def serve_file(fp, filename, content_type, last_modified=None, cache_expires=None, size=None,
embed=True, etag=None):
     '''Sets the response headers and serves as a wsgi iter'''
-    if filename and last_modified:
-        etag_cache(u'{0}?{1}'.format(filename, last_modified).encode('utf-8'))
+    if not etag and filename and last_modified:
+        etag = u'{0}?{1}'.format(filename, last_modified).encode('utf-8')
+    if etag:
+        etag_cache(etag)
     pylons.response.headers['Content-Type'] = ''
     pylons.response.content_type = content_type.encode('utf-8')
     pylons.response.cache_expires = cache_expires or asint(tg.config.get('files_expires_header_secs',
60 * 60))


Mime
View raw message