summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand Bordage <bordage.bertrand@gmail.com>2017-06-04 17:27:08 (GMT)
committerBertrand Bordage <bordage.bertrand@gmail.com>2017-06-04 17:27:08 (GMT)
commitf82c48f391bb1cf23ed03463ea5d167f9821d305 (patch)
tree8f55e25001eba696268ae3ac0ccc7ad3101430c1
parentce9ec0c0a1e21dcf4d0cb5f2cdf3e95456a5f3c1 (diff)
downloaddjango-cachalot-f82c48f391bb1cf23ed03463ea5d167f9821d305.zip
django-cachalot-f82c48f391bb1cf23ed03463ea5d167f9821d305.tar.gz
django-cachalot-f82c48f391bb1cf23ed03463ea5d167f9821d305.tar.bz2
Fixes Django 1.8 compatibility.
-rw-r--r--cachalot/apps.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/cachalot/apps.py b/cachalot/apps.py
index 1651062..c0d122a 100644
--- a/cachalot/apps.py
+++ b/cachalot/apps.py
@@ -1,3 +1,4 @@
+from django import VERSION as django_version
from django.apps import AppConfig
from django.conf import settings
from django.core.checks import register, Tags, Warning, Error
@@ -9,7 +10,11 @@ from .settings import (
SUPPORTED_ONLY)
-@register(Tags.caches, Tags.compatibility)
+DJANGO_GTE_1_10 = django_version[:2] >= (1, 10)
+
+
+@register(*((Tags.caches, Tags.compatibility)
+ if DJANGO_GTE_1_10 else (Tags.compatibility,)))
def check_cache_compatibility(app_configs, **kwargs):
cache = settings.CACHES[cachalot_settings.CACHALOT_CACHE]
cache_backend = cache['BACKEND']
@@ -23,7 +28,8 @@ def check_cache_compatibility(app_configs, **kwargs):
return []
-@register(Tags.database, Tags.compatibility)
+@register(*((Tags.database, Tags.compatibility)
+ if DJANGO_GTE_1_10 else (Tags.compatibility,)))
def check_databases_compatibility(app_configs, **kwargs):
errors = []
databases = settings.DATABASES