equal
deleted
inserted
replaced
40 # GMT time required |
40 # GMT time required |
41 date_format = "%a, %d %b %Y %H:%M:%S GMT" |
41 date_format = "%a, %d %b %Y %H:%M:%S GMT" |
42 |
42 |
43 def etag(self): |
43 def etag(self): |
44 return self.view.id + '/' + ','.join(sorted(self.req.user.groups)) |
44 return self.view.id + '/' + ','.join(sorted(self.req.user.groups)) |
45 |
45 |
46 def max_age(self): |
46 def max_age(self): |
47 # 0 to actually force revalidation |
47 # 0 to actually force revalidation |
48 return 0 |
48 return 0 |
49 |
49 |
50 def last_modified(self): |
50 def last_modified(self): |
51 return self.view.last_modified() |
51 return self.view.last_modified() |
52 |
52 |
53 def set_headers(self): |
53 def set_headers(self): |
54 req = self.req |
54 req = self.req |
55 try: |
55 try: |
56 req.set_header('Etag', '"%s"' % self.etag()) |
56 req.set_header('Etag', '"%s"' % self.etag()) |
57 except NoEtag: |
57 except NoEtag: |
127 |
127 |
128 |
128 |
129 viewmod.EntityView.http_cache_manager = EntityHTTPCacheManager |
129 viewmod.EntityView.http_cache_manager = EntityHTTPCacheManager |
130 |
130 |
131 viewmod.StartupView.http_cache_manager = MaxAgeHTTPCacheManager |
131 viewmod.StartupView.http_cache_manager = MaxAgeHTTPCacheManager |
132 viewmod.StartupView.cache_max_age = 60*60*2 # stay in http cache for 2 hours by default |
132 viewmod.StartupView.cache_max_age = 60*60*2 # stay in http cache for 2 hours by default |