mirror of
https://github.com/jazzband/django-dbtemplates.git
synced 2026-03-16 22:20:28 +00:00
Merge branch 'hotfix/cache-fixes'
This commit is contained in:
commit
b71032fa13
5 changed files with 12 additions and 14 deletions
|
|
@ -1,4 +1,4 @@
|
|||
VERSION = (1, 0, 0, "f", 0) # following PEP 386
|
||||
VERSION = (1, 0, 1, "f", 0) # following PEP 386
|
||||
DEV_N = None
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,16 @@ import posixpath
|
|||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
# If we are on Django 1.3 AND using the new CACHES setting...
|
||||
cache = getattr(settings, "CACHES", {}).get("dbtemplates",
|
||||
# .. or fall back to the old CACHE_BACKEND setting
|
||||
getattr(settings, "DBTEMPLATES_CACHE_BACKEND", None))
|
||||
if "dbtemplates" in getattr(settings, "CACHES", {}):
|
||||
# If we are on Django 1.3 AND using the new CACHES setting..
|
||||
cache = "dbtemplates"
|
||||
else:
|
||||
# ..or fall back to the old CACHE_BACKEND setting
|
||||
cache = getattr(settings, "DBTEMPLATES_CACHE_BACKEND", None)
|
||||
if not cache:
|
||||
raise ImproperlyConfigured("Please specify a dbtemplates "
|
||||
"cache backend in your settings.")
|
||||
elif cache.startswith("dbtemplates."):
|
||||
elif isinstance(cache, basestring) and cache.startswith("dbtemplates."):
|
||||
raise ImproperlyConfigured("Please upgrade to one of the supported "
|
||||
"backends as defined in the Django docs.")
|
||||
CACHE_BACKEND = cache
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@ from dbtemplates import settings
|
|||
|
||||
|
||||
def get_cache_backend():
|
||||
if "://" in settings.CACHE_BACKEND:
|
||||
cache = get_cache(settings.CACHE_BACKEND)
|
||||
else:
|
||||
cache = get_cache(**settings.CACHE_BACKEND)
|
||||
return cache
|
||||
return get_cache(settings.CACHE_BACKEND)
|
||||
|
||||
cache = get_cache_backend()
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ copyright = u'2010, Jannis Leidel'
|
|||
# The short X.Y version.
|
||||
version = '1.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.0'
|
||||
release = '1.0.1'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ Setup
|
|||
'dbtemplates',
|
||||
)
|
||||
|
||||
* Add ``dbtemplates.loader.load_template_source`` to the
|
||||
``TEMPLATE_LOADERS`` list in the settings.py of your Django project
|
||||
* Add ``dbtemplates.loader.Loader`` to the ``TEMPLATE_LOADERS`` list
|
||||
in the settings.py of your Django project.
|
||||
|
||||
It should look something like this::
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue