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
f0b8f72d
Commit
f0b8f72d
authored
Dec 23, 2013
by
Thomas Parslow
Committed by
Timothée Peignier
Feb 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mime types should not be unicode strings
parent
3f5ad202
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
pipeline/conf.py
+5
-5
pipeline/utils.py
+1
-1
tests/tests/test_template.py
+8
-8
No files found.
pipeline/conf.py
View file @
f0b8f72d
...
...
@@ -63,11 +63,11 @@ DEFAULTS = {
'PIPELINE_LESS_ARGUMENTS'
:
''
,
'PIPELINE_MIMETYPES'
:
(
(
'text/coffeescript'
,
'.coffee'
),
(
'text/less'
,
'.less'
),
(
'text
/javascript'
,
'.js'
),
(
'text/x-sass'
,
'.sass'
),
(
'text/x-scss'
,
'.scss'
)
(
b
'text/coffeescript'
,
'.coffee'
),
(
b
'text/less'
,
'.less'
),
(
b
'application
/javascript'
,
'.js'
),
(
b
'text/x-sass'
,
'.sass'
),
(
b
'text/x-scss'
,
'.scss'
)
),
'PIPELINE_EMBED_MAX_IMAGE_SIZE'
:
32700
,
...
...
pipeline/utils.py
View file @
f0b8f72d
...
...
@@ -36,7 +36,7 @@ def guess_type(path, default=None):
mimetype
,
_
=
mimetypes
.
guess_type
(
path
)
if
not
mimetype
:
return
default
return
mimetype
return
smart_str
(
mimetype
)
def
relpath
(
path
,
start
=
posixpath
.
curdir
):
...
...
tests/tests/test_template.py
View file @
f0b8f72d
...
...
@@ -35,19 +35,19 @@ class JinjaTest(TestCase):
def
test_package_js
(
self
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_js "scripts"
%
}"""
)
self
.
assertEqual
(
u'<script type="
text
/javascript" src="/static/scripts.js" charset="utf-8"></script>'
,
template
.
render
())
self
.
assertEqual
(
u'<script type="
application
/javascript" src="/static/scripts.js" charset="utf-8"></script>'
,
template
.
render
())
def
test_package_js_async
(
self
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_js "scripts_async"
%
}"""
)
self
.
assertEqual
(
u'<script async type="
text
/javascript" src="/static/scripts_async.js" charset="utf-8"></script>'
,
template
.
render
())
self
.
assertEqual
(
u'<script async type="
application
/javascript" src="/static/scripts_async.js" charset="utf-8"></script>'
,
template
.
render
())
def
test_package_js_defer
(
self
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_js "scripts_defer"
%
}"""
)
self
.
assertEqual
(
u'<script defer type="
text
/javascript" src="/static/scripts_defer.js" charset="utf-8"></script>'
,
template
.
render
())
self
.
assertEqual
(
u'<script defer type="
application
/javascript" src="/static/scripts_defer.js" charset="utf-8"></script>'
,
template
.
render
())
def
test_package_js_async_defer
(
self
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_js "scripts_async_defer"
%
}"""
)
self
.
assertEqual
(
u'<script async defer type="
text
/javascript" src="/static/scripts_async_defer.js" charset="utf-8"></script>'
,
template
.
render
())
self
.
assertEqual
(
u'<script async defer type="
application
/javascript" src="/static/scripts_async_defer.js" charset="utf-8"></script>'
,
template
.
render
())
class
DjangoTest
(
TestCase
):
...
...
@@ -64,16 +64,16 @@ class DjangoTest(TestCase):
def
test_compressed_js
(
self
):
rendered
=
self
.
render_template
(
u"""{
%
load compressed
%
}{
%
compressed_js "scripts"
%
}"""
)
self
.
assertEqual
(
u'<script type="
text
/javascript" src="/static/scripts.js" charset="utf-8"></script>'
,
rendered
)
self
.
assertEqual
(
u'<script type="
application
/javascript" src="/static/scripts.js" charset="utf-8"></script>'
,
rendered
)
def
test_compressed_js_async
(
self
):
rendered
=
self
.
render_template
(
u"""{
%
load compressed
%
}{
%
compressed_js "scripts_async"
%
}"""
)
self
.
assertEqual
(
u'<script async type="
text
/javascript" src="/static/scripts_async.js" charset="utf-8"></script>'
,
rendered
)
self
.
assertEqual
(
u'<script async type="
application
/javascript" src="/static/scripts_async.js" charset="utf-8"></script>'
,
rendered
)
def
test_compressed_js_defer
(
self
):
rendered
=
self
.
render_template
(
u"""{
%
load compressed
%
}{
%
compressed_js "scripts_defer"
%
}"""
)
self
.
assertEqual
(
u'<script defer type="
text
/javascript" src="/static/scripts_defer.js" charset="utf-8"></script>'
,
rendered
)
self
.
assertEqual
(
u'<script defer type="
application
/javascript" src="/static/scripts_defer.js" charset="utf-8"></script>'
,
rendered
)
def
test_compressed_js_async_defer
(
self
):
rendered
=
self
.
render_template
(
u"""{
%
load compressed
%
}{
%
compressed_js "scripts_async_defer"
%
}"""
)
self
.
assertEqual
(
u'<script async defer type="
text
/javascript" src="/static/scripts_async_defer.js" charset="utf-8"></script>'
,
rendered
)
self
.
assertEqual
(
u'<script async defer type="
application
/javascript" src="/static/scripts_async_defer.js" charset="utf-8"></script>'
,
rendered
)
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