django 1.4 no longer has DATABASE_ENGINE setting, using DATABASE['default']['ENGINE'] instead, if former is not found

This commit is contained in:
Dale O'Brien 2012-03-26 09:37:23 +11:00
parent 832b000c49
commit 530f18142c

View file

@ -33,8 +33,15 @@ class Loader(BaseLoader):
# in the cache indicating that queries failed, with the current
# timestamp.
site = Site.objects.get_current()
display_name = 'dbtemplates:%s:%s:%s' % (settings.DATABASE_ENGINE,
template_name, site.domain)
if 'DATABASE_ENGINE' in dir(settings):
# DATABASE_ENGINE is in django 1.1, but has been deprecated in Django 1.2
display_name = 'dbtemplates:%s:%s:%s' % (settings.DATABASE_ENGINE,
template_name, site.domain)
else:
display_name = 'dbtemplates:%s:%s:%s' % (settings.DATABASES['default']['ENGINE'],
template_name, site.domain)
cache_key = get_cache_key(template_name)
if cache:
try: