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
1ae99d43
Commit
1ae99d43
authored
Apr 03, 2013
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #203 from dnerdy/pipeline-extension-render-individual-css-fix
Fix PipelineExtension.render_individual_css arguments
parents
0d245056
6e9095ef
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
1 deletions
+30
-1
AUTHORS
+1
-0
pipeline/jinja2/ext.py
+1
-1
tests/tests/test_extension.py
+9
-0
tests/utils.py
+19
-0
No files found.
AUTHORS
View file @
1ae99d43
...
...
@@ -29,6 +29,7 @@ or just made Pipeline more awesome.
* Jared Scott <jscott@convertro.com>
* Kyle MacFarlane <kyle@deletethetrees.com>
* Luke Yu-Po Chen <nuemail@gmail.com>
* Mark Sandstrom <mark@deliciouslynerdy.com>
* Matt Dennewitz <mattdennewitz@gmail.com>
* Max Klymyshyn <klymyshyn@gmail.com>
* Melvin Laplanche <melvin.laplanche+dev@gmail.com>
...
...
pipeline/jinja2/ext.py
View file @
1ae99d43
...
...
@@ -46,7 +46,7 @@ class PipelineExtension(CompressedMixin, Extension):
template
=
self
.
environment
.
get_template
(
template_name
)
return
template
.
render
(
context
)
def
render_individual_css
(
self
,
package
,
paths
):
def
render_individual_css
(
self
,
package
,
paths
,
**
kwargs
):
tags
=
[
self
.
render_css
(
package
,
path
)
for
path
in
paths
]
return
'
\n
'
.
join
(
tags
)
...
...
tests/tests/test_extension.py
View file @
1ae99d43
...
...
@@ -7,6 +7,8 @@ from django.test import TestCase
from
pipeline.jinja2.ext
import
PipelineExtension
from
tests.utils
import
pipeline_settings
class
ExtensionTest
(
TestCase
):
def
setUp
(
self
):
...
...
@@ -23,6 +25,13 @@ class ExtensionTest(TestCase):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_css "screen"
%
}"""
)
self
.
assertEqual
(
u'<link href="/static/screen.css" rel="stylesheet" type="text/css" />'
,
template
.
render
())
def
test_package_css_debug
(
self
):
with
pipeline_settings
(
DEBUG
=
True
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_css "screen"
%
}"""
)
self
.
assertEqual
(
u'''<link href="/static/pipeline/css/first.css" rel="stylesheet" type="text/css" />
<link href="/static/pipeline/css/second.css" rel="stylesheet" type="text/css" />
<link href="/static/pipeline/css/urls.css" rel="stylesheet" type="text/css" />'''
,
template
.
render
())
def
test_package_js
(
self
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_js "scripts"
%
}"""
)
self
.
assertEqual
(
u'<script type="text/css" src="/static/scripts.css" charset="utf-8"></script>'
,
template
.
render
())
tests/utils.py
View file @
1ae99d43
import
contextlib
import
os
from
pipeline.conf
import
settings
def
_
(
path
):
# Make sure the path contains only the correct separator
return
path
.
replace
(
'/'
,
os
.
sep
)
.
replace
(
'
\\
'
,
os
.
sep
)
@contextlib.contextmanager
def
pipeline_settings
(
**
kwargs
):
try
:
saved
=
{}
for
name
,
value
in
kwargs
.
items
():
saved
[
name
]
=
getattr
(
settings
,
name
)
setattr
(
settings
,
name
,
value
)
yield
finally
:
for
name
,
value
in
saved
.
items
():
setattr
(
settings
,
name
,
value
)
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