From 47bcd9cbeb9d8b1a58da3b93a26ed94f0252b9e0 Mon Sep 17 00:00:00 2001 From: Antti Hirvonen Date: Wed, 12 Sep 2012 16:13:19 +0300 Subject: [PATCH 1/2] Fixed CompilerFilter to always output Unicode strings --- compressor/filters/base.py | 4 +++- compressor/tests/test_filters.py | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compressor/filters/base.py b/compressor/filters/base.py index 7b53d1f..43d4e5b 100644 --- a/compressor/filters/base.py +++ b/compressor/filters/base.py @@ -6,6 +6,7 @@ import subprocess from django.core.exceptions import ImproperlyConfigured from django.core.files.temp import NamedTemporaryFile from django.utils.importlib import import_module +from django.utils.encoding import smart_unicode from compressor.conf import settings from compressor.exceptions import FilterError @@ -142,4 +143,5 @@ class CompilerFilter(FilterBase): if self.outfile is not None: filtered = self.outfile.read() self.outfile.close() - return filtered + + return smart_unicode(filtered) diff --git a/compressor/tests/test_filters.py b/compressor/tests/test_filters.py index 4c8b47c..7a36ee5 100644 --- a/compressor/tests/test_filters.py +++ b/compressor/tests/test_filters.py @@ -67,6 +67,11 @@ class PrecompilerTestCase(TestCase): compiler = CompilerFilter(content=self.content, filename=self.filename, command=command) self.assertEqual(u"body { color:#990; }%s" % os.linesep, compiler.input()) + def test_precompiler_output_unicode(self): + command = '%s %s' % (sys.executable, self.test_precompiler) + compiler = CompilerFilter(content=self.content, filename=self.filename, command=command) + self.assertEqual(type(compiler.input()), unicode) + class CssMinTestCase(TestCase): def test_cssmin_filter(self): From 1e2dcbfff3f2f706fb213cd7c839b2cf7cbf7af9 Mon Sep 17 00:00:00 2001 From: Alexander Afanasiev Date: Wed, 3 Apr 2013 17:52:53 +0400 Subject: [PATCH 2/2] Clarifying default for COMPRESS_CACHE_BACKEND --- docs/settings.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.txt b/docs/settings.txt index c2d684c..a774e85 100644 --- a/docs/settings.txt +++ b/docs/settings.txt @@ -334,7 +334,7 @@ Caching settings .. attribute:: COMPRESS_CACHE_BACKEND - :Default: ``"default"`` or ``CACHE_BACKEND`` + :Default: ``CACHES["default"]`` or ``CACHE_BACKEND`` The backend to use for caching, in case you want to use a different cache backend for Django Compressor.