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
a3f94e59
Commit
a3f94e59
authored
Nov 29, 2012
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8 fixes
parent
76c3060c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
18 deletions
+15
-18
pipeline/compilers/__init__.py
+2
-2
pipeline/compressors/__init__.py
+2
-2
pipeline/conf/settings.py
+3
-5
pipeline/jinja2/ext.py
+2
-3
pipeline/packager.py
+4
-4
pipeline/storage.py
+1
-1
pipeline/templatetags/compressed.py
+1
-1
No files found.
pipeline/compilers/__init__.py
View file @
a3f94e59
...
...
@@ -82,8 +82,8 @@ class CompilerError(Exception):
class
SubProcessCompiler
(
CompilerBase
):
def
execute_command
(
self
,
command
,
content
=
None
,
cwd
=
None
):
pipe
=
subprocess
.
Popen
(
command
,
shell
=
True
,
cwd
=
cwd
,
stdout
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdout
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
if
content
:
pipe
.
stdin
.
write
(
content
)
...
...
pipeline/compressors/__init__.py
View file @
a3f94e59
...
...
@@ -128,7 +128,7 @@ class Compressor(object):
if
asset_path
.
startswith
(
"http"
)
or
asset_path
.
startswith
(
"//"
):
return
"url(
%
s)"
%
asset_path
asset_url
=
self
.
construct_asset_path
(
asset_path
,
path
,
output_filename
,
variant
)
output_filename
,
variant
)
return
"url(
%
s)"
%
asset_url
content
=
self
.
read_text
(
path
)
# content needs to be unicode to avoid explosions with non-ascii chars
...
...
@@ -232,7 +232,7 @@ class CompressorError(Exception):
class
SubProcessCompressor
(
CompressorBase
):
def
execute_command
(
self
,
command
,
content
):
pipe
=
subprocess
.
Popen
(
command
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdin
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
pipe
.
stdin
.
write
(
smart_bytes
(
content
))
pipe
.
stdin
.
close
()
...
...
pipeline/conf/settings.py
View file @
a3f94e59
...
...
@@ -7,14 +7,12 @@ PIPELINE_ROOT = getattr(settings, 'PIPELINE_ROOT', settings.STATIC_ROOT)
PIPELINE_URL
=
getattr
(
settings
,
'PIPELINE_URL'
,
settings
.
STATIC_URL
)
PIPELINE_STORAGE
=
getattr
(
settings
,
'PIPELINE_STORAGE'
,
'pipeline.storage.PipelineFinderStorage'
)
'pipeline.storage.PipelineFinderStorage'
)
PIPELINE_CSS_COMPRESSOR
=
getattr
(
settings
,
'PIPELINE_CSS_COMPRESSOR'
,
'pipeline.compressors.yui.YUICompressor'
)
'pipeline.compressors.yui.YUICompressor'
)
PIPELINE_JS_COMPRESSOR
=
getattr
(
settings
,
'PIPELINE_JS_COMPRESSOR'
,
'pipeline.compressors.yui.YUICompressor'
)
'pipeline.compressors.yui.YUICompressor'
)
PIPELINE_COMPILERS
=
getattr
(
settings
,
'PIPELINE_COMPILERS'
,
[])
PIPELINE_CSS
=
getattr
(
settings
,
'PIPELINE_CSS'
,
{})
...
...
pipeline/jinja2/ext.py
View file @
a3f94e59
from
__future__
import
unicode_literals
from
django.utils
import
six
from
django.contrib.staticfiles.storage
import
staticfiles_storage
from
django.conf
import
settings
...
...
@@ -16,7 +15,7 @@ class Jinja2Compressed(object):
raise
PackageNotFound
(
"Package type must be css or js, supplied
%
s"
%
package_type
)
self
.
package_type
=
package_type
self
.
loader
=
FileSystemLoader
((
app_directories
.
app_template_dirs
+
settings
.
TEMPLATE_DIRS
))
settings
.
TEMPLATE_DIRS
))
def
get_package
(
self
,
name
):
"""Get the js or css package."""
...
...
@@ -93,7 +92,7 @@ class Jinja2Compressed(object):
def
render_inline_js
(
self
,
package
,
js
):
template_name
=
(
self
.
package
.
template_name
or
"pipeline/inline_js.jinja"
)
"pipeline/inline_js.jinja"
)
context
=
self
.
package
.
extra_context
context
.
update
({
'source'
:
js
...
...
pipeline/packager.py
View file @
a3f94e59
...
...
@@ -30,12 +30,12 @@ class Package(object):
@property
def
paths
(
self
):
return
[
path
for
path
in
self
.
sources
if
not
path
.
endswith
(
settings
.
PIPELINE_TEMPLATE_EXT
)]
if
not
path
.
endswith
(
settings
.
PIPELINE_TEMPLATE_EXT
)]
@property
def
templates
(
self
):
return
[
path
for
path
in
self
.
sources
if
path
.
endswith
(
settings
.
PIPELINE_TEMPLATE_EXT
)]
if
path
.
endswith
(
settings
.
PIPELINE_TEMPLATE_EXT
)]
@property
def
output_filename
(
self
):
...
...
@@ -88,8 +88,8 @@ class Packager(object):
def
pack_stylesheets
(
self
,
package
,
**
kwargs
):
return
self
.
pack
(
package
,
self
.
compressor
.
compress_css
,
css_compressed
,
output_filename
=
package
.
output_filename
,
variant
=
package
.
variant
,
**
kwargs
)
output_filename
=
package
.
output_filename
,
variant
=
package
.
variant
,
**
kwargs
)
def
compile
(
self
,
paths
,
force
=
False
):
return
self
.
compiler
.
compile
(
paths
,
force
=
force
)
...
...
pipeline/storage.py
View file @
a3f94e59
...
...
@@ -3,7 +3,7 @@ from __future__ import unicode_literals
import
os
from
django.contrib.staticfiles
import
finders
from
django.contrib.staticfiles.storage
import
CachedFilesMixin
,
StaticFilesStorage
# noqa
from
django.contrib.staticfiles.storage
import
CachedFilesMixin
,
StaticFilesStorage
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.files.storage
import
get_storage_class
...
...
pipeline/templatetags/compressed.py
View file @
a3f94e59
from
__future__
import
unicode_literals
from
django.contrib.staticfiles.storage
import
staticfiles_storage
# noqa
from
django.contrib.staticfiles.storage
import
staticfiles_storage
from
django
import
template
from
django.template.loader
import
render_to_string
...
...
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