Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
4f9cb08f
Commit
4f9cb08f
authored
Sep 16, 2011
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix use of os.path.relpath to calculate relative path
parent
095ac354
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
pipeline/compressors/__init__.py
+6
-6
tests/tests/compressor.py
+1
-1
No files found.
pipeline/compressors/__init__.py
View file @
4f9cb08f
...
...
@@ -191,21 +191,21 @@ class Compressor(object):
name
,
ext
=
os
.
path
.
splitext
(
path
)
return
MIME_TYPES
[
ext
]
def
absolute_path
(
self
,
asset_path
,
css_path
):
def
absolute_path
(
self
,
path
,
start
):
"""
Return the absolute public path for an asset,
given the path of the stylesheet that contains it.
"""
if
os
.
path
.
isabs
(
asset_
path
):
path
=
os
.
path
.
join
(
settings
.
PIPELINE_ROOT
,
asset_
path
)
if
os
.
path
.
isabs
(
path
):
path
=
os
.
path
.
join
(
settings
.
PIPELINE_ROOT
,
path
)
else
:
path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
css_path
),
asset_
path
)
path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
start
),
path
)
return
os
.
path
.
normpath
(
path
)
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
(
os
.
sep
,
os
.
path
.
relpath
(
absolute_path
,
compress_root
))
absolute_path
=
self
.
absolute_path
(
absolute_path
,
settings
.
PIPELINE_ROOT
)
return
os
.
path
.
join
(
os
.
sep
,
os
.
path
.
relpath
(
absolute_path
,
settings
.
PIPELINE_ROOT
))
def
read_file
(
self
,
path
):
"""Read file content in binary mode"""
...
...
tests/tests/compressor.py
View file @
4f9cb08f
...
...
@@ -34,7 +34,7 @@ class CompressorTest(TestCase):
'js/first.js'
,
'js/second.js'
])
self
.
assertEquals
(
"""
(function() { function concat() {
\n
console.log(arguments);
\n
}
\n
function cat() {
\n
console.log("hello world");
\n
} }).call(this);
"""
,
js
)
self
.
assertEquals
(
"""
function concat() {
\n
console.log(arguments);
\n
}
\n
function cat() {
\n
console.log("hello world");
\n
}
"""
,
js
)
@patch.object
(
base64
,
'b64encode'
)
def
test_encoded_content
(
self
,
mock
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment