[ckan-changes] commit/ckan: pudo: [middleware] make static max age configurable

Bitbucket commits-noreply at bitbucket.org
Tue Jun 14 10:28:19 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/7a9c6b1060cf/
changeset:   7a9c6b1060cf
user:        pudo
date:        2011-06-14 12:27:53
summary:     [middleware] make static max age configurable
affected #:  2 files (280 bytes)

--- a/ckan/config/middleware.py	Mon Jun 13 10:54:06 2011 +0200
+++ b/ckan/config/middleware.py	Tue Jun 14 12:27:53 2011 +0200
@@ -97,8 +97,11 @@
 
     if asbool(static_files):
         # Serve static files
+        static_max_age = None if not asbool(config.get('ckan.cache_enabled')) \
+            else int(config.get('ckan.static_max_age', 3600))
+
         static_app = StaticURLParser(config['pylons.paths']['static_files'],
-                cache_max_age=3600)
+                cache_max_age=static_max_age)
         static_parsers = [static_app, app]
 
         # Configurable extra static file paths
@@ -107,7 +110,7 @@
             if public_path.strip():
                 extra_static_parsers.append(
                     StaticURLParser(public_path.strip(),
-                        cache_max_age=3600)
+                        cache_max_age=static_max_age)
                 )
         app = Cascade(extra_static_parsers+static_parsers)
 


--- a/doc/configuration.rst	Mon Jun 13 10:54:06 2011 +0200
+++ b/doc/configuration.rst	Tue Jun 14 12:27:53 2011 +0200
@@ -107,6 +107,10 @@
  ckan.controllers.apiv2.package.list.expires = 600
  ckan.controllers.apiv2.package.show.expires = 600
 
+There is also en option to set the max-age value of static files delivered by
+paster::
+
+ ckan.static_max_age = 3600
 
 openid_enabled
 --------------
@@ -371,4 +375,4 @@
   ckan.dumps_url = http://ckan.net/dump/
   ckan.dumps_format = CSV/JSON
 
-If there is a page which allows you to download a dump of the entire catalogue then specify the URL and the format here, so that it can be advertised in the web interface. The dumps_format is just a string for display.
\ No newline at end of file
+If there is a page which allows you to download a dump of the entire catalogue then specify the URL and the format here, so that it can be advertised in the web interface. The dumps_format is just a string for display.

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list