You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2012/10/09 21:42:26 UTC
[1/2] git commit: [#4571] for all files served out of mongo,
add expires and last-modified headers, remove no-cache headers
Updated Branches:
refs/heads/db/4571 [created] dc43dde86
[#4571] for all files served out of mongo, add expires and last-modified headers, remove no-cache headers
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/dc43dde8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/dc43dde8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/dc43dde8
Branch: refs/heads/db/4571
Commit: dc43dde869895bffa280f39e54f2750370f314f5
Parents: 2074e91
Author: Dave Brondsema <db...@geek.net>
Authored: Tue Oct 9 19:28:07 2012 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Oct 9 19:28:07 2012 +0000
----------------------------------------------------------------------
Allura/allura/model/filesystem.py | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dc43dde8/Allura/allura/model/filesystem.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/filesystem.py b/Allura/allura/model/filesystem.py
index 36269e4..69f74e5 100644
--- a/Allura/allura/model/filesystem.py
+++ b/Allura/allura/model/filesystem.py
@@ -5,6 +5,8 @@ import logging
import pylons
import Image
from gridfs import GridFS
+from tg import config
+from paste.deploy.converters import asint
from ming import schema
from ming.orm import session, FieldProperty
@@ -93,6 +95,10 @@ class File(MappedClass):
fp = self.rfile()
pylons.response.headers['Content-Type'] = ''
pylons.response.content_type = self.content_type.encode('utf-8')
+ pylons.response.cache_expires = asint(config.get('files_expires_header_secs', 60 * 60))
+ pylons.response.last_modified = self._id.generation_time
+ del pylons.response.headers['Pragma']
+ del pylons.response.headers['Cache-Control']
if not embed:
pylons.response.headers.add(
'Content-Disposition',