Refactored the CSSCompressor's output method to not accidentally trigger file lookups.
This commit is contained in:
@@ -44,14 +44,13 @@ class CssCompressor(Compressor):
|
|||||||
|
|
||||||
def output(self, *args, **kwargs):
|
def output(self, *args, **kwargs):
|
||||||
# Populate self.split_content
|
# Populate self.split_content
|
||||||
self.split_contents()
|
|
||||||
if not hasattr(self, 'media_nodes'):
|
|
||||||
return super(CssCompressor, self).output(*args, **kwargs)
|
|
||||||
if (settings.COMPRESS_ENABLED or settings.COMPRESS_PRECOMPILERS or
|
if (settings.COMPRESS_ENABLED or settings.COMPRESS_PRECOMPILERS or
|
||||||
kwargs.get('forced', False)):
|
kwargs.get('forced', False)):
|
||||||
ret = []
|
self.split_contents()
|
||||||
for media, subnode in self.media_nodes:
|
if hasattr(self, 'media_nodes'):
|
||||||
subnode.extra_context.update({'media': media})
|
ret = []
|
||||||
ret.append(subnode.output(*args, **kwargs))
|
for media, subnode in self.media_nodes:
|
||||||
return ''.join(ret)
|
subnode.extra_context.update({'media': media})
|
||||||
return self.content
|
ret.append(subnode.output(*args, **kwargs))
|
||||||
|
return ''.join(ret)
|
||||||
|
return super(CssCompressor, self).output(*args, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user