From a9461cc869b06af2ba339a993178ee42e7479e5b Mon Sep 17 00:00:00 2001 From: Ben Firshman Date: Thu, 22 Sep 2011 21:17:55 +0100 Subject: [PATCH] Ensure hunks are filtered when compression is forced --- compressor/base.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compressor/base.py b/compressor/base.py index 19c5e6a..02e1675 100644 --- a/compressor/base.py +++ b/compressor/base.py @@ -114,14 +114,14 @@ class Compressor(object): [self.content] + self.mtimes).encode(self.charset), 12) @memoize - def hunks(self, mode='file'): + def hunks(self, mode='file', forced=False): """ The heart of content parsing, iterates of the list of split contents and looks at its kind to decide what to do with it. Should yield a bunch of precompiled and/or rendered hunks. """ - enabled = settings.COMPRESS_ENABLED + enabled = settings.COMPRESS_ENABLED or forced for kind, value, basename, elem in self.split_contents(): precompiled = False @@ -160,14 +160,14 @@ class Compressor(object): return self.filter(content, method=METHOD_OUTPUT) @memoize - def filtered_input(self, mode='file'): + def filtered_input(self, mode='file', forced=False): """ Passes each hunk (file or code) to the 'input' methods of the compressor filters. """ verbatim_content = [] rendered_content = [] - for mode, hunk in self.hunks(mode): + for mode, hunk in self.hunks(mode, forced): if mode == 'verbatim': verbatim_content.append(hunk) else: @@ -208,7 +208,7 @@ class Compressor(object): any custom modification. Calls other mode specific methods or simply returns the content directly. """ - verbatim_content, rendered_content = self.filtered_input(mode) + verbatim_content, rendered_content = self.filtered_input(mode, forced) if not verbatim_content and not rendered_content: return ''