From f7687b0ac9502b718dfa2b58da021be82fa2cf83 Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Sun, 23 Oct 2016 21:10:10 +0200 Subject: [PATCH] Stops checking compatibility for caches other than CACHALOT_CACHE. --- cachalot/apps.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cachalot/apps.py b/cachalot/apps.py index 8ddd0d5..9f12ae6 100644 --- a/cachalot/apps.py +++ b/cachalot/apps.py @@ -1,8 +1,9 @@ from django.apps import AppConfig from django.conf import settings -from django.core.checks import register, Tags, Error, Warning +from django.core.checks import register, Tags, Error from .monkey_patch import patch +from .settings import cachalot_settings VALID_DATABASE_ENGINES = { @@ -37,16 +38,18 @@ VALID_CACHE_BACKENDS = { @register(Tags.compatibility) def check_compatibility(app_configs, **kwargs): + cache_alias = cachalot_settings.CACHALOT_CACHE + caches = {cache_alias: settings.CACHES[cache_alias]} + errors = [] for setting, k, valid_values in ( (settings.DATABASES, 'ENGINE', VALID_DATABASE_ENGINES), - (settings.CACHES, 'BACKEND', VALID_CACHE_BACKENDS)): - for alias, d in setting.items(): - value = d[k] + (caches, 'BACKEND', VALID_CACHE_BACKENDS)): + for config in setting.values(): + value = config[k] if value not in valid_values: - error_class = Error if alias == 'default' else Warning errors.append( - error_class( + Error( '`%s` is not compatible with django-cachalot.' % value, id='cachalot.E001', )