[http cache/json controller] ensure json_view does proper cache validation #390986 stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Wed, 10 Feb 2010 14:24:05 +0100
branchstable
changeset 4557 a0571ff0cb5d
parent 4524 2eb36514ad6d
child 4558 259e7ef7c373
[http cache/json controller] ensure json_view does proper cache validation #390986
web/controller.py
web/views/basecontrollers.py
--- a/web/controller.py	Tue Feb 09 08:15:20 2010 +0100
+++ b/web/controller.py	Wed Feb 10 14:24:05 2010 +0100
@@ -154,6 +154,10 @@
             rql = 'SET X %s Y where X eid %%(x)s, Y eid %%(y)s' % rtype
             execute(rql, {'x': subj, 'y': obj}, ('x', 'y'))
 
+    def validate_cache(self, view):
+        view.set_http_cache_headers()
+        self.req.validate_cache()
+
 
     def reset(self):
         """reset form parameters and redirect to a view determinated by given
--- a/web/views/basecontrollers.py	Tue Feb 09 08:15:20 2010 +0100
+++ b/web/views/basecontrollers.py	Wed Feb 10 14:24:05 2010 +0100
@@ -142,10 +142,6 @@
         if view.add_to_breadcrumbs and not view.binary:
             self.req.update_breadcrumbs()
 
-    def validate_cache(self, view):
-        view.set_http_cache_headers()
-        self.req.validate_cache()
-
     def execute_linkto(self, eid=None):
         """XXX __linkto parameter may cause security issue
 
@@ -350,6 +346,7 @@
         except NoSelectableObject:
             vid = req.form.get('fallbackvid', 'noresult')
             view = self.vreg['views'].select(vid, req, rset=rset)
+        self.validate_cache(view)
         return self._call_view(view)
 
     @xhtmlize