diff --git a/compressor/filters/css_default.py b/compressor/filters/css_default.py index 5323092..46f27c3 100644 --- a/compressor/filters/css_default.py +++ b/compressor/filters/css_default.py @@ -25,7 +25,7 @@ class CssAbsoluteFilter(FilterBase): url = url.strip(' \'"') if url.startswith('http://') or url.startswith('/'): return "url('%s')" % url - full_url = '/'.join([self.directory_name, url]) + full_url = '/'.join([str(self.directory_name), url]) full_url = os.path.normpath(full_url) if self.has_http: full_url = "http://%s" % full_url diff --git a/tests/core/tests.py b/tests/core/tests.py index 854477e..482bfb1 100644 --- a/tests/core/tests.py +++ b/tests/core/tests.py @@ -138,6 +138,9 @@ class CssMediaTestCase(TestCase): class TemplatetagTestCase(TestCase): + def setUp(self): + settings.COMPRESS = True + def render(self, template_string, context_dict=None): """A shortcut for testing template output.""" if context_dict is None: @@ -158,6 +161,15 @@ class TemplatetagTestCase(TestCase): out = u'' self.assertEqual(out, self.render(template, context)) + def test_nonascii_css_tag(self): + template = u"""{% load compress %}{% compress css %} + + {% endcompress %} + """ + context = { 'MEDIA_URL': settings.MEDIA_URL } + out = '' + self.assertEqual(out, self.render(template, context)) + def test_js_tag(self): template = u"""{% load compress %}{% compress js %} diff --git a/tests/media/css/nonasc.css b/tests/media/css/nonasc.css new file mode 100644 index 0000000..2afa456 --- /dev/null +++ b/tests/media/css/nonasc.css @@ -0,0 +1,2 @@ +p { background: url( '../../images/test.png' ); } +.byline:before { content: " — "; } \ No newline at end of file