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
073fbd73
Commit
073fbd73
authored
Nov 20, 2014
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix url rewriting. Close #388
parent
5d0ecfa6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
3 deletions
+5
-3
pipeline/compressors/__init__.py
+3
-3
tests/assets/css/urls.css
+1
-0
tests/tests/models.py
+0
-0
tests/tests/test_compressor.py
+1
-0
No files found.
pipeline/compressors/__init__.py
View file @
073fbd73
...
...
@@ -14,8 +14,8 @@ from pipeline.storage import default_storage
from
pipeline.utils
import
to_class
,
relpath
from
pipeline.exceptions
import
CompressorError
URL_DETECTOR
=
r
'url\([\'"]?([^\s)]+\.[a-z]+[^\'"\s]*)[\'"]?\)'
URL_REPLACER
=
r
'url\(__EMBED__(.+?)(\?\d+)?\)'
URL_DETECTOR
=
r
"""url\(['"]{0,1}\s*(.*?)["']{0,1}\)"""
URL_REPLACER
=
r
"""url\(__EMBED__(.+?)(\?\d+)?\)"""
NON_REWRITABLE_URL
=
re
.
compile
(
r'^(http:|https:|data:|//)'
)
DEFAULT_TEMPLATE_FUNC
=
"template"
...
...
@@ -158,7 +158,7 @@ class Compressor(object):
return
False
if
not
(
re
.
search
(
settings
.
PIPELINE_EMBED_PATH
,
path
.
replace
(
'
\\
'
,
'/'
))
and
self
.
storage
.
exists
(
path
)):
return
False
if
not
ex
t
in
EMBED_EXTS
:
if
ext
no
t
in
EMBED_EXTS
:
return
False
if
not
(
font
or
len
(
self
.
encoded_content
(
path
))
<
settings
.
PIPELINE_EMBED_MAX_IMAGE_SIZE
):
return
False
...
...
tests/assets/css/urls.css
View file @
073fbd73
...
...
@@ -21,3 +21,4 @@
.no-protocol-url
{
background-image
:
url(//images/sprite-buttons.png)
;
}
@font-face
{
src
:
url(../fonts/pipeline.eot)
;
src
:
url(../fonts/pipeline.eot?#iefix)
format
(
'embedded-opentype'
),
url(../fonts/pipeline.woff)
format
(
'woff'
),
url(../fonts/pipeline.ttf)
format
(
'truetype'
);}
tests/tests/models.py
0 → 100644
View file @
073fbd73
tests/tests/test_compressor.py
View file @
073fbd73
...
...
@@ -150,6 +150,7 @@ class CompressorTest(TestCase):
.no-protocol-url {
background-image: url(//images/sprite-buttons.png);
}
@font-face{src:url(../pipeline/fonts/pipeline.eot);src:url(../pipeline/fonts/pipeline.eot?#iefix) format('embedded-opentype'),url(../pipeline/fonts/pipeline.woff) format('woff'),url(../pipeline/fonts/pipeline.ttf) format('truetype');}
"""
,
output
)
def
test_url_rewrite_data_uri
(
self
):
...
...
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