Only try to load the cache if compression is really enabled.

This commit is contained in:
Jannis Leidel
2011-04-13 00:57:11 +02:00
parent ede5b59682
commit 5aa192ad87

View File

@@ -64,12 +64,16 @@ class CompressorNode(template.Node):
if debug:
return content
compressor = self.compressor_cls(content)
cachekey = self.cache_key(compressor)
output = self.cache_get(cachekey)
if settings.COMPRESS_ENABLED:
cachekey = self.cache_key(compressor)
output = self.cache_get(cachekey)
else:
cachekey = output = None
if output is None or forced:
try:
output = compressor.output(self.mode, forced=forced)
self.cache_set(cachekey, output)
if cachekey:
self.cache_set(cachekey, output)
except:
if settings.DEBUG or forced:
from traceback import format_exc