Commit 05e0a940 by Timothée Peignier

ensuring that absolute path stay absolute. close #3

parent 4cd6026f
......@@ -207,7 +207,7 @@ class Compressor(object):
def relative_path(self, absolute_path):
"""Rewrite paths relative to the output stylesheet path"""
compress_root = os.path.normpath(settings.PIPELINE_ROOT)
return os.path.join('../', absolute_path.replace(compress_root, ''))
return os.path.join(os.sep, absolute_path.replace(compress_root, ''))
def read_file(self, path):
"""Read file content in binary mode"""
......
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
PIPELINE_ROOT = getattr(settings, 'PIPELINE_ROOT', settings.MEDIA_ROOT)
......@@ -57,3 +58,7 @@ PIPELINE_LESS_ARGUMENTS = getattr(settings, 'PIPELINE_LESS_ARGUMENTS', '-x')
if PIPELINE_COMPILERS is None:
PIPELINE_COMPILERS = []
if not PIPELINE_URL:
raise ImproperlyConfigured("You're using the pipeline app "
"without having set the required STATIC_URL setting.")
......@@ -109,7 +109,7 @@ class Packager(object):
if 'variant' in config[name]:
packages[name]['variant'] = config[name]['variant']
if 'manifest' in config[name]:
packages[name]['manifest'] = config[name]['manifest']
packages[name]['manifest'] = config[name]['manifest']
return packages
......
......@@ -2,6 +2,9 @@
background-image: url(../images/sprite-buttons.png);
}
.absolute-url {
background-image: url(/images/sprite-buttons.png);
}
.absolute-full-url {
background-image: url(http://localhost/images/sprite-buttons.png);
}
.no-protocol-url {
......
......@@ -82,10 +82,13 @@ class CompressorTest(TestCase):
output = self.compressor.concatenate_and_rewrite([
'css/urls.css',
])
self.assertEquals(""".relative-url {
self.assertMultiLineEqual(""".relative-url {
background-image: url(http://localhost/static/images/sprite-buttons.png);
}
.absolute-url {
background-image: url(http://localhost/static/images/sprite-buttons.png);
}
.absolute-full-url {
background-image: url(http://localhost/images/sprite-buttons.png);
}
.no-protocol-url {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment