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
919f7b46
Commit
919f7b46
authored
Jun 15, 2011
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use commonprefix rather than our custom function
parent
6b850444
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
16 deletions
+2
-16
pipeline/compressors/__init__.py
+2
-16
No files found.
pipeline/compressors/__init__.py
View file @
919f7b46
...
...
@@ -73,7 +73,7 @@ class Compressor(object):
if
not
paths
:
return
compiled
namespace
=
settings
.
PIPELINE_TEMPLATE_NAMESPACE
base_path
=
self
.
base_path
(
paths
)
base_path
=
os
.
path
.
commonprefix
(
paths
)
for
path
in
paths
:
contents
=
self
.
read_file
(
path
)
contents
=
re
.
sub
(
r"\r?\n"
,
""
,
contents
)
...
...
@@ -94,27 +94,13 @@ class Compressor(object):
def
template_name
(
self
,
path
,
base
):
name
=
os
.
path
.
basename
(
path
)
base
=
os
.
path
.
abspath
(
base
)
if
base
:
name
=
re
.
sub
(
r"^
%
s\/(.*)
%
s$"
%
(
re
.
escape
(
base
),
re
.
escape
(
settings
.
PIPELINE_TEMPLATE_EXT
)
),
r"\1"
,
path
)
return
re
.
sub
(
r"[\/\\]"
,
"_"
,
name
)
def
base_path
(
self
,
paths
):
if
len
(
paths
)
<=
1
:
return
None
paths
.
sort
()
first
=
paths
[
0
]
.
split
(
'/'
)
last
=
paths
[
-
1
]
.
split
(
'/'
)
i
=
0
while
first
[
i
]
==
last
[
i
]
and
i
<=
len
(
first
):
i
+=
1
base
=
'/'
.
join
(
first
[
0
:
i
])
if
not
base
:
return
None
else
:
return
base
def
concatenate_and_rewrite
(
self
,
paths
,
variant
=
None
):
"""Concatenate together files and rewrite urls"""
stylesheets
=
[]
...
...
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