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
c917ca04
Commit
c917ca04
authored
Dec 14, 2011
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix templatetag rendering
parent
165c78b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
pipeline/templatetags/compressed.py
+9
-8
No files found.
pipeline/templatetags/compressed.py
View file @
c917ca04
try
:
from
django.contrib.staticfiles.storage
import
staticfiles_storage
except
ImportError
:
from
staticfiles.storage
import
staticfiles_storage
except
ImportError
:
from
django.contrib.staticfiles.storage
import
staticfiles_storage
from
django
import
template
from
django.template.loader
import
render_to_string
...
...
@@ -28,19 +29,19 @@ class CompressedCSSNode(template.Node):
return
''
# fail silently, do not return anything if an invalid group is specified
if
settings
.
PIPELINE
:
return
self
.
render_css
(
package
)
return
self
.
render_css
(
package
,
package
[
"output"
]
)
else
:
package
[
'paths'
]
=
self
.
packager
.
compile
(
package
[
'paths'
])
return
self
.
render_individual
(
package
)
def
render_css
(
self
,
package
):
def
render_css
(
self
,
package
,
path
):
context
=
{}
if
not
'template'
in
package
:
package
[
'template'
]
=
"pipeline/css.html"
if
'context'
in
package
:
context
=
package
[
'context'
]
context
.
update
({
'url'
:
staticfiles_storage
.
url
(
pa
ckage
[
"output"
]
)
'url'
:
staticfiles_storage
.
url
(
pa
th
)
})
return
render_to_string
(
package
[
'template'
],
context
)
...
...
@@ -69,20 +70,20 @@ class CompressedJSNode(template.Node):
return
'
\n
'
.
join
([
self
.
render_external
(
package
,
url
)
for
url
in
package
[
'externals'
]])
if
settings
.
PIPELINE
:
return
self
.
render_js
(
package
)
return
self
.
render_js
(
package
,
package
[
"output"
]
)
else
:
package
[
'paths'
]
=
self
.
packager
.
compile
(
package
[
'paths'
])
templates
=
self
.
packager
.
pack_templates
(
package
)
return
self
.
render_individual
(
package
,
templates
)
def
render_js
(
self
,
package
):
def
render_js
(
self
,
package
,
path
):
context
=
{}
if
not
'template'
in
package
:
package
[
'template'
]
=
"pipeline/js.html"
if
'context'
in
package
:
context
=
package
[
'context'
]
context
.
update
({
'url'
:
staticfiles_storage
.
url
(
pa
ckage
[
"output"
]
)
'url'
:
staticfiles_storage
.
url
(
pa
th
)
})
return
render_to_string
(
package
[
'template'
],
context
)
...
...
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