|
a/Allura/allura/lib/utils.py |
|
b/Allura/allura/lib/utils.py |
|
... |
|
... |
13 |
from formencode import Invalid
|
13 |
from formencode import Invalid
|
14 |
from tg.decorators import before_validate
|
14 |
from tg.decorators import before_validate
|
15 |
from pylons import response, c
|
15 |
from pylons import response, c
|
16 |
from paste.httpheaders import CACHE_CONTROL, EXPIRES
|
16 |
from paste.httpheaders import CACHE_CONTROL, EXPIRES
|
17 |
from webhelpers.html import literal
|
17 |
from webhelpers.html import literal
|
|
|
18 |
from webob import exc
|
18 |
|
19 |
|
19 |
from ew import jinja2_ew as ew
|
20 |
from ew import jinja2_ew as ew
|
20 |
from ming.utils import LazyProperty
|
21 |
from ming.utils import LazyProperty
|
|
|
22 |
|
|
|
23 |
def permanent_redirect(url):
|
|
|
24 |
try:
|
|
|
25 |
tg.redirect(url)
|
|
|
26 |
except exc.HTTPFound, err:
|
|
|
27 |
raise exc.HTTPMovedPermanently(location=err.location)
|
21 |
|
28 |
|
22 |
def cache_forever():
|
29 |
def cache_forever():
|
23 |
headers = [
|
30 |
headers = [
|
24 |
(k,v) for k,v in response.headers.items()
|
31 |
(k,v) for k,v in response.headers.items()
|
25 |
if k.lower() not in ('pragma', 'cache-control') ]
|
32 |
if k.lower() not in ('pragma', 'cache-control') ]
|