added a test to check for DummyCache when using CacheRosettaStorage, which could explain issues #51 and #56

This commit is contained in:
Marco Bonetti 2013-01-09 15:03:01 +01:00
parent 5a51e39738
commit 3009ab1525
3 changed files with 18 additions and 1 deletions

View file

@ -1,4 +1,4 @@
VERSION = (0, 6, 8)
VERSION = (0, 7, 0)
def get_version(svn=False, limit=3):

View file

@ -1,5 +1,7 @@
from django.core.cache import cache
from django.conf import settings
from django.utils import importlib
from django.core.exceptions import ImproperlyConfigured
import hashlib
import time
@ -56,6 +58,10 @@ class CacheRosettaStorage(BaseRosettaStorage):
# so we need to per-user key prefix, which we store in the session
def __init__(self, request):
super(CacheRosettaStorage, self).__init__(request)
if 'dummycache' in settings.CACHES['default']['BACKEND'].lower():
raise ImproperlyConfigured("You can't use the CacheRosettaStorage if your cache isn't correctly set up (you are use the DummyCache cache backend).")
if 'rosetta_cache_storage_key_prefix' in self.request.session:
self._key_prefix = self.request.session['rosetta_cache_storage_key_prefix']
else:

View file

@ -17,6 +17,17 @@ DATABASES = {
}
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
'KEY_PREFIX': 'ROSETTA_TEST'
}
}
#CACHES = {'default': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache'}}
TEST_DATABASE_CHARSET = "utf8"
TEST_DATABASE_COLLATION = "utf8_general_ci"