Completed
Push — master ( 8124bf...d2c927 )
by Bertrand
01:15
created

Settings.__getattribute__()   A

Complexity

Conditions 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
from django.conf import settings
2
3
4
class Settings(object):
5
    CACHALOT_ENABLED = True
6
    CACHALOT_CACHE = 'default'
7
    CACHALOT_CACHE_RANDOM = False
8
    CACHALOT_INVALIDATE_RAW = True
9
    CACHALOT_ONLY_CACHABLE_TABLES = frozenset()
10
    CACHALOT_UNCACHABLE_TABLES = frozenset(('django_migrations',))
11
    CACHALOT_QUERY_KEYGEN = 'cachalot.utils.get_query_cache_key'
12
    CACHALOT_TABLE_KEYGEN = 'cachalot.utils.get_table_cache_key'
13
14
    def __getattribute__(self, item):
15
        if hasattr(settings, item):
16
            return getattr(settings, item)
17
        return super(Settings, self).__getattribute__(item)
18
19
    def __setattr__(self, key, value):
20
        raise AttributeError(
21
            "Don't modify `cachalot_settings`, use "
22
            "`django.test.utils.override_settings` or "
23
            "`django.conf.settings` instead.")
24
25
26
cachalot_settings = Settings()
27