Switch to unified view
a | b/Allura/allura/lib/utils.py | ||
---|---|---|---|
1 | from pylons import response |
||
2 | from paste.httpheaders import CACHE_CONTROL, EXPIRES |
||
3 | |||
4 | def cache_forever(): |
||
5 | headers = [ |
||
6 | (k,v) for k,v in response.headers.items() |
||
7 | if k.lower() not in ('pragma', 'cache-control') ] |
||
8 | delta = CACHE_CONTROL.apply( |
||
9 | headers, |
||
10 | public=True, |
||
11 | max_age=60*60*24*365) |
||
12 | EXPIRES.update(headers, delta=delta) |
||
13 | response.headers.pop('cache-control', None) |
||
14 | response.headers.pop('pragma', None) |
||
15 | response.headers.update(headers) |