Commits

Hynek Cernoch  committed 11f39e5

Fixed TIMEOUT for Django 1.3 with old settings for backward compatibility

  • Participants
  • Parent commits e38cd7d

Comments (0)

Files changed (1)

File keyedcache/__init__.py

     try:
         CACHE_TIMEOUT = CACHES['default']['TIMEOUT']
     except KeyError:
-        CACHE_TIMEOUT = 0
-        log.warn("No TIMEOUT found in settings.CACHES['default'], so we used 0, disabling the cache system.  Please update your settings to add a TIMEOUT and avoid this warning.")
+        CACHE_TIMEOUT = getattr(settings, 'CACHE_TIMEOUT', 0)
+        log.warn("No TIMEOUT found in settings.CACHES['default'], so we used %s%s. "
+                 "Please update your settings to add a TIMEOUT and avoid this warning.",
+                 CACHE_TIMEOUT,
+                 CACHE_TIMEOUT == 0 and ", disabling the cache system" or "")
     
 except AttributeError:
     try: