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
246b1093
Commit
246b1093
authored
Oct 27, 2010
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make css url replace more versatile
parent
9662e69f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
11 deletions
+7
-11
compress/filters/css_url_replace/__init__.py
+7
-11
No files found.
compress/filters/css_url_replace/__init__.py
View file @
246b1093
from
django.conf
import
settings
from
django.conf
import
settings
from
compress.filter_base
import
FilterBase
,
FilterError
from
compress.filter_base
import
FilterBase
REPLACE_LIST
=
getattr
(
settings
,
'COMPRESS_CSS_URL_REPLACE'
,
[])
CSS_REPLACE
=
getattr
(
settings
,
'COMPRESS_CSS_URL_REPLACE'
,
[])
class
CSSURLReplace
(
FilterBase
):
class
CSSURLReplace
(
FilterBase
):
def
filter_css
(
self
,
css
):
def
filter_css
(
self
,
css
):
filtered_css
=
css
for
old
,
new
in
CSS_REPLACE
.
iteritems
():
if
type
(
REPLACE_LIST
)
==
list
:
css
=
css
.
replace
(
old
,
new
)
for
REPLACE
in
REPLACE_LIST
:
if
self
.
verbose
:
if
len
(
REPLACE
)
==
2
:
print
'Replaced "
%
s" with "
%
s"'
%
(
old
,
new
)
filtered_css
=
filtered_css
.
replace
(
REPLACE
[
0
],
REPLACE
[
1
])
return
css
if
self
.
verbose
:
print
'Replaced "
%
s" with "
%
s"'
%
REPLACE
return
filtered_css
\ No newline at end of file
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