Projet

Général

Profil

0002-visualization-add-setting-to-disable-cache-27407.patch

Benjamin Dauvergne, 15 janvier 2019 13:01

Télécharger (2,07 ko)

Voir les différences:

Subject: [PATCH 2/3] visualization: add setting to disable cache (#27407)

 bijoe/settings.py            | 2 ++
 bijoe/visualization/utils.py | 4 +++-
 tests/settings.py            | 1 +
 tox.ini                      | 1 +
 4 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 tests/settings.py
bijoe/settings.py
170 170

  
171 171
BIJOE_SCHEMAS = []
172 172

  
173
BIJOE_CACHE = True
174

  
173 175
if 'BIJOE_SETTINGS_FILE' in os.environ:
174 176
    execfile(os.environ['BIJOE_SETTINGS_FILE'])
bijoe/visualization/utils.py
26 26
from django.utils.translation import ugettext_lazy as _
27 27
from django.core.cache import cache
28 28
from django.http import Http404
29
from django.conf import settings
29 30

  
30 31
from ..utils import get_warehouses, human_join
31 32
from ..engine import Engine
......
164 165
        data = cache.get(key)
165 166
        if data is None:
166 167
            data = list(self.data())
167
            cache.set(key, data)
168
            if settings.BIJOE_CACHE:
169
                cache.set(key, data)
168 170
        return data
169 171

  
170 172
    def table(self):
tests/settings.py
1
BIJOE_CACHE = False
tox.ini
12 12
basepython = python2
13 13
setenv =
14 14
	DJANGO_SETTINGS_MODULE=bijoe.settings
15
	BIJOE_SETTINGS_FILE=tests/settings.py
15 16
	coverage: COVERAGE=--junit-xml=test_results.xml --cov=bijoe --cov-report xml 
16 17
deps =
17 18
	dj18: django>=1.8,<1.9
18
-