diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2007-10-13 02:08:47 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2007-10-13 02:08:47 +0000 |
commit | 5d82fa56a12dfbdfa6bef069e5e6eb0b37b93be0 (patch) | |
tree | d955d517703ce464065035100cd8de84a9adcd45 | |
parent | Merge branch 'finch' into live (diff) | |
download | packages-3-5d82fa56a12dfbdfa6bef069e5e6eb0b37b93be0.tar.gz packages-3-5d82fa56a12dfbdfa6bef069e5e6eb0b37b93be0.tar.bz2 packages-3-5d82fa56a12dfbdfa6bef069e5e6eb0b37b93be0.zip |
Add Last-Modified headers for caching.
-rw-r--r-- | web/controller.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/web/controller.py b/web/controller.py index 0664d78..03b6d16 100644 --- a/web/controller.py +++ b/web/controller.py @@ -32,7 +32,10 @@ class Root(object): day_list = latest_per_day(latest_entries, left_daycount) - updated = last_modified(entry_filter.latest_entry()) + latest_entry = entry_filter.latest_entry() + updated = last_modified(latest_entry) + http_lastmodified = time.strftime('%a, %d %b %Y %H:%M:%S GMT',time.gmtime(latest_entry[1])) + cherrypy.response.headers['Last-Modified'] = http_lastmodified return template.render(arches = self.arches, daylist = day_list, center_pkgs = center_pkgs, lastupdate = updated) @@ -71,7 +74,10 @@ class Root(object): day_list = latest_per_day(left_entrylist, left_daycount) - updated = last_modified(entry_filter.latest_entry()) + latest_entry = entry_filter.latest_entry() + updated = last_modified(latest_entry) + http_lastmodified = time.strftime('%a, %d %b %Y %H:%M:%S GMT',time.gmtime(latest_entry[1])) + cherrypy.response.headers['Last-Modified'] = http_lastmodified return template.render(arches = self.arches, daylist = day_list, center_pkgs = center_pkgs, lastupdate = updated) @@ -111,7 +117,10 @@ class Root(object): day_list = latest_per_day(left_entrylist, left_daycount) - updated = last_modified(entry_filter.latest_entry()) + latest_entry = entry_filter.latest_entry() + updated = last_modified(latest_entry) + http_lastmodified = time.strftime('%a, %d %b %Y %H:%M:%S GMT',time.gmtime(latest_entry[1])) + cherrypy.response.headers['Last-Modified'] = http_lastmodified return template.render(arches = self.arches, daylist = day_list, center_pkgs = center_pkgs, lastupdate = updated) @@ -153,7 +162,10 @@ class Root(object): day_list = latest_per_day(left_entrylist, left_daycount) - updated = last_modified(entry_filter.latest_entry()) + latest_entry = entry_filter.latest_entry() + updated = last_modified(latest_entry) + http_lastmodified = time.strftime('%a, %d %b %Y %H:%M:%S GMT',time.gmtime(latest_entry[1])) + cherrypy.response.headers['Last-Modified'] = http_lastmodified return template.render(arches = self.arches, daylist = day_list, center_pkgs = center_pkgs, lastupdate = updated) @@ -191,6 +203,7 @@ def main(): # site-wide config cherrypy.config.update({ + 'log.error_file': '/tmp/cherrypy_packages2.gentoo.log', #'tools.caching.on': True, #'tools.caching.cache_class': cherrypy.lib.caching.MemoryCache, 'tools.decode.on': True, |