Skip to content

Commit

Permalink
fix absolute path generation
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberdelia committed Nov 3, 2011
1 parent 8c16870 commit f5ec70b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pipeline/compressors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def concatenate(self, paths):

def construct_asset_path(self, asset_path, css_path, variant=None):
"""Return a rewritten asset URL for a stylesheet"""
public_path = self.absolute_path(asset_path, css_path)
public_path = self.absolute_path(asset_path, os.path.dirname(css_path))
if self.embeddable(public_path, variant):
return "__EMBED__%s" % public_path
if not os.path.isabs(asset_path):
Expand Down Expand Up @@ -195,7 +195,7 @@ def absolute_path(self, path, start):
if os.path.isabs(path):
path = os.path.join(settings.PIPELINE_ROOT, path)
else:
path = os.path.join(os.path.dirname(start), path)
path = os.path.join(start, path)
return os.path.normpath(path)

def relative_path(self, absolute_path):
Expand Down
4 changes: 2 additions & 2 deletions tests/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
'tests'
],
MEDIA_URL='/media/',
MEDIA_ROOT=os.path.join(TEST_DIR, 'media/'),
MEDIA_ROOT=os.path.join(TEST_DIR, 'media'),
STATIC_URL='/static/',
STATIC_ROOT=os.path.join(TEST_DIR, 'static/'),
STATIC_ROOT=os.path.join(TEST_DIR, 'static'),
TEMPLATE_DIRS=(
os.path.join(TEST_DIR, 'templates'),
),
Expand Down
4 changes: 2 additions & 2 deletions tests/tests/compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def test_relative_path(self):

def test_absolute_path(self):
absolute_path = self.compressor.absolute_path('../../images/sprite.png',
'css/plugins/gallery.css')
'css/plugins/')
self.assertEquals(absolute_path, 'images/sprite.png')
absolute_path = self.compressor.absolute_path('/images/sprite.png',
'css/plugins/gallery.css')
'css/plugins/')
self.assertEquals(absolute_path, '/images/sprite.png')

def test_template_name(self):
Expand Down

0 comments on commit f5ec70b

Please sign in to comment.