visualization: add setting to disable cache (#27407)

This commit is contained in:
Benjamin Dauvergne 2019-01-14 12:30:08 +01:00
parent 6451f27c18
commit 86b169bd6c
4 changed files with 7 additions and 1 deletions

View File

@ -170,5 +170,7 @@ SELECT2_CSS = xstatic('select2', 'select2.min.css')
BIJOE_SCHEMAS = []
BIJOE_CACHE = True
if 'BIJOE_SETTINGS_FILE' in os.environ:
execfile(os.environ['BIJOE_SETTINGS_FILE'])

View File

@ -26,6 +26,7 @@ from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.core.cache import cache
from django.http import Http404
from django.conf import settings
from ..utils import get_warehouses, human_join
from ..engine import Engine
@ -164,7 +165,8 @@ class Visualization(object):
data = cache.get(key)
if data is None:
data = list(self.data())
cache.set(key, data)
if settings.BIJOE_CACHE:
cache.set(key, data)
return data
def table(self):

1
tests/settings.py Normal file
View File

@ -0,0 +1 @@
BIJOE_CACHE = False

View File

@ -12,6 +12,7 @@ usedevelop = true
basepython = python2
setenv =
DJANGO_SETTINGS_MODULE=bijoe.settings
BIJOE_SETTINGS_FILE=tests/settings.py
coverage: COVERAGE=--junit-xml=test_results.xml --cov=bijoe --cov-report xml
deps =
dj18: django>=1.8,<1.9