[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[snapshot/master] On 404 errors, retain the previously set caching headers



---
 web/app/snapshot/controllers/error.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/web/app/snapshot/controllers/error.py b/web/app/snapshot/controllers/error.py
index e1b671e..713666d 100644
--- a/web/app/snapshot/controllers/error.py
+++ b/web/app/snapshot/controllers/error.py
@@ -1,7 +1,7 @@
 import cgi
 
 from paste.urlparser import PkgResourcesParser
-from pylons import request, config, tmpl_context as c
+from pylons import request, response, config, tmpl_context as c
 from pylons.controllers.util import forward
 from pylons.middleware import error_document_template
 from webhelpers.html.builder import literal
@@ -35,6 +35,10 @@ class ErrorController(BaseController):
             c.code = cgi.escape(request.GET.get('code', str(resp.status_int)))
             c.title = 'Error %s'%(c.code)
             c.content = content
+            if resp and c.code == '404':
+                response.expires = resp.expires
+                response.cache_control = resp.cache_control
+                response.pragma = resp.pragma
             return render('/error.mako')
 
     def img(self, id):
-- 
1.5.6.5



Reply to: