From e7dcf3a03ffd5ff09bad439c5913baf6536839b2 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 13 May 2011 11:59:58 +0200 Subject: [PATCH] Got rid of Compressor.hash method. --- compressor/base.py | 5 +---- compressor/tests/tests.py | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/compressor/base.py b/compressor/base.py index 9385231..f828d64 100644 --- a/compressor/base.py +++ b/compressor/base.py @@ -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): """ diff --git a/compressor/tests/tests.py b/compressor/tests/tests.py index df08d5b..76ff392 100644 --- a/compressor/tests/tests.py +++ b/compressor/tests/tests.py @@ -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''