From c3fab9b01bc87c36f44bde6e6c1b97c338227da1 Mon Sep 17 00:00:00 2001 From: Benjamin Wohlwend Date: Tue, 16 Mar 2010 13:58:40 +0100 Subject: [PATCH] Use the `safe` filter for inline content and respect the use of the `media` attribute on inline style if available. --- compressor/__init__.py | 5 ++++- compressor/templates/compressor/css_inline.html | 2 +- compressor/templates/compressor/js_inline.html | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compressor/__init__.py b/compressor/__init__.py index 248bbe3..57515eb 100644 --- a/compressor/__init__.py +++ b/compressor/__init__.py @@ -152,7 +152,10 @@ class Compressor(object): return render_to_string(self.template_name, context) def output_inline(self): - return render_to_string(self.template_name_inline, {'content': settings.COMPRESS and self.combined or self.concat()}) + context = {'content': settings.COMPRESS and self.combined or self.concat()} + if hasattr(self, 'extra_context'): + context.extend(self.extra_context) + return render_to_string(self.template_name_inline, context) class CssCompressor(Compressor): diff --git a/compressor/templates/compressor/css_inline.html b/compressor/templates/compressor/css_inline.html index 83253f8..ae64fa6 100644 --- a/compressor/templates/compressor/css_inline.html +++ b/compressor/templates/compressor/css_inline.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/compressor/templates/compressor/js_inline.html b/compressor/templates/compressor/js_inline.html index 6931349..586bd93 100644 --- a/compressor/templates/compressor/js_inline.html +++ b/compressor/templates/compressor/js_inline.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file