fix more encoding problems
This commit is contained in:
@@ -80,7 +80,9 @@ class Compressor(object):
|
|||||||
return self._hunks
|
return self._hunks
|
||||||
|
|
||||||
def concat(self):
|
def concat(self):
|
||||||
return "\n".join(self.hunks)
|
# if any of the hunks are unicode, all of them will be coerced
|
||||||
|
# this breaks any hunks with non-ASCII data in them
|
||||||
|
return "\n".join([str(hunk) for hunk in self.hunks])
|
||||||
|
|
||||||
def filter(self, content, method, **kwargs):
|
def filter(self, content, method, **kwargs):
|
||||||
content = content
|
content = content
|
||||||
|
|||||||
@@ -38,4 +38,4 @@ class CssMediaFilter(FilterBase):
|
|||||||
self.media = elem['media']
|
self.media = elem['media']
|
||||||
except (TypeError, KeyError):
|
except (TypeError, KeyError):
|
||||||
return self.content
|
return self.content
|
||||||
return "@media %s {%s}" % (self.media, self.content)
|
return "@media %s {%s}" % (str(self.media), self.content)
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ class CssMediaTestCase(TestCase):
|
|||||||
out = u'@media screen {body { background:#990; }}\n@media print {p { border:5px solid green;}}\n@media all {body { color:#fff; }}'
|
out = u'@media screen {body { background:#990; }}\n@media print {p { border:5px solid green;}}\n@media all {body { color:#fff; }}'
|
||||||
self.assertEqual(out, self.cssNode.combined)
|
self.assertEqual(out, self.cssNode.combined)
|
||||||
|
|
||||||
|
|
||||||
class TemplatetagTestCase(TestCase):
|
class TemplatetagTestCase(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
settings.COMPRESS = True
|
settings.COMPRESS = True
|
||||||
@@ -163,11 +162,12 @@ class TemplatetagTestCase(TestCase):
|
|||||||
|
|
||||||
def test_nonascii_css_tag(self):
|
def test_nonascii_css_tag(self):
|
||||||
template = u"""{% load compress %}{% compress css %}
|
template = u"""{% load compress %}{% compress css %}
|
||||||
<link rel="stylesheet" href="{{ MEDIA_URL }}css/nonasc.css" type="text/css" charset="utf-8">
|
<link rel="stylesheet" href="{{ MEDIA_URL }}css/nonasc.css" type="text/css" media="print" charset="utf-8">
|
||||||
|
<style type="text/css">p { border:5px solid green;}</style>
|
||||||
{% endcompress %}
|
{% endcompress %}
|
||||||
"""
|
"""
|
||||||
context = { 'MEDIA_URL': settings.MEDIA_URL }
|
context = { 'MEDIA_URL': settings.MEDIA_URL }
|
||||||
out = '<link rel="stylesheet" href="/media/CACHE/css/fc35bb10bce9.css" type="text/css" media="all" charset="utf-8">'
|
out = '<link rel="stylesheet" href="/media/CACHE/css/68da639dbb24.css" type="text/css" media="all" charset="utf-8">'
|
||||||
self.assertEqual(out, self.render(template, context))
|
self.assertEqual(out, self.render(template, context))
|
||||||
|
|
||||||
def test_js_tag(self):
|
def test_js_tag(self):
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
p { background: url( '../../images/test.png' ); }
|
|
||||||
.byline:before { content: " — "; }
|
.byline:before { content: " — "; }
|
||||||
2
tests/media/css/url/nonasc.css
Normal file
2
tests/media/css/url/nonasc.css
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
p { background: url( '../../images/test.png' ); }
|
||||||
|
.byline:before { content: " — "; }
|
||||||
Reference in New Issue
Block a user