Switch to unified view

a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
1
import mimetypes
1
import mimetypes
2
import logging
2
3
3
from pylons import response
4
from pylons import response
4
from paste.httpheaders import CACHE_CONTROL, EXPIRES
5
from paste.httpheaders import CACHE_CONTROL, EXPIRES
6
from ming.utils import LazyProperty
5
7
6
def cache_forever():
8
def cache_forever():
7
    headers = [
9
    headers = [
8
        (k,v) for k,v in response.headers.items()
10
        (k,v) for k,v in response.headers.items()
9
        if k.lower() not in ('pragma', 'cache-control') ]
11
        if k.lower() not in ('pragma', 'cache-control') ]
...
...
25
    if content_type[0]:
27
    if content_type[0]:
26
        content_type = content_type[0]
28
        content_type = content_type[0]
27
    else:
29
    else:
28
        content_type = 'application/octet-stream'
30
        content_type = 'application/octet-stream'
29
    return content_type
31
    return content_type
32
33
34
class lazy_logger(object):
35
    '''Lazy instatiation of a logger, to ensure that it does not get
36
    created before logging is configured (which would make it disabled)'''
37
38
    def __init__(self, name):
39
        self._name = name
40
41
    @LazyProperty
42
    def _logger(self):
43
        return logging.getLogger(self._name)
44
45
    def __getattr__(self, name):
46
        if name.startswith('_'): raise AttributeError, name
47
        return getattr(self._logger, name)