Got rid of Compressor.hash method.

This commit is contained in:
Jannis Leidel
2011-05-13 11:59:58 +02:00
parent 64f5b6df61
commit e7dcf3a03f
2 changed files with 3 additions and 6 deletions

View File

@@ -151,14 +151,11 @@ class Compressor(object):
@cached_property
def combined(self):
def hash(self, content):
return get_hexdigest(content)[:12]
return self.filter(self.concat, method=METHOD_OUTPUT)
def filepath(self, content):
return os.path.join(settings.COMPRESS_OUTPUT_DIR.strip(os.sep),
self.output_prefix, "%s.%s" % (self.hash(content), self.type))
self.output_prefix, "%s.%s" % (get_hexdigest(content, 12), self.type))
def output(self, mode='file', forced=False):
"""

View File

@@ -29,7 +29,7 @@ from django.test import TestCase
from compressor import base
from compressor.base import SOURCE_HUNK, SOURCE_FILE
from compressor.cache import get_hashed_mtime
from compressor.cache import get_hashed_mtime, get_hexdigest
from compressor.conf import settings
from compressor.css import CssCompressor
from compressor.js import JsCompressor
@@ -91,7 +91,7 @@ class CompressorTestCase(TestCase):
self.assert_(is_cachekey.match(self.css_node.cachekey), "cachekey is returning something that doesn't look like r'django_compressor\.%s\.\w{12}'" % host_name)
def test_css_hash(self):
self.assertEqual('666f3aa8eacd', self.css_node.hash(self.css))
self.assertEqual('666f3aa8eacd', get_hexdigest(self.css, 12))
def test_css_return_if_on(self):
output = u'<link rel="stylesheet" href="/media/CACHE/css/f7c661b7a124.css" type="text/css">'