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

cachalot.Settings   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %
Metric Value
dl 0
loc 18
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A Settings.__getattribute__() 0 4 2
A Settings.__setattr__() 0 3 1
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