Coverage for /Users/marco/Code/django-rosetta/rosetta/storage.py : 64.52%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
except ImportError: from django.core.cache import get_cache cache = get_cache(rosetta_settings.ROSETTA_CACHE_NAME)
except ImportError: from django.utils import importlib
raise NotImplementedError
raise NotImplementedError
raise NotImplementedError
raise NotImplementedError
return default
pass
return False
pass
super(SessionRosettaStorage, self).__init__(request)
if 'signed_cookies' in settings.SESSION_ENGINE and django.VERSION[1] >= 6 and 'pickle' not in settings.SESSION_SERIALIZER.lower(): raise ImproperlyConfigured("Sorry, but django-rosetta doesn't support the `signed_cookies` SESSION_ENGINE in Django >= 1.6, because rosetta specific session files cannot be serialized.")
if key in self.request.session: return self.request.session[key] return default
self.request.session[key] = val
return key in self.request.session
del(self.request.session[key])
# unlike the session storage backend, cache is shared among all users # so we need to per-user key prefix, which we store in the session
else:
raise ImproperlyConfigured("You can't use the CacheRosettaStorage because your Django Session storage doesn't seem to be working. The CacheRosettaStorage relies on the Django Session storage to avoid conflicts.")
# Make sure we're not using DummyCache raise ImproperlyConfigured("You can't use the CacheRosettaStorage if your cache isn't correctly set up (you are using the DummyCache cache backend).")
# Make sure the cache actually works raise ImproperlyConfigured("You can't use the CacheRosettaStorage if your cache isn't correctly set up, please double check your Django DATABASES setting and that the cache server is responding.") finally:
# print ('get', self._key_prefix + key)
# print ('set', self._key_prefix + key)
# print ('has', self._key_prefix + key) return (self._key_prefix + key) in cache
# print ('del', self._key_prefix + key)
|