Upgrade to django-pipeline 1.6.14 (#20449)
This commit is contained in:
@@ -26,26 +26,26 @@ class EdxFragmentView(FragmentView):
|
||||
@staticmethod
|
||||
def get_css_dependencies(group):
|
||||
"""
|
||||
Returns list of CSS dependencies belonging to `group` in settings.PIPELINE_JS.
|
||||
Returns list of CSS dependencies belonging to `group` in settings.PIPELINE['JAVASCRIPT'].
|
||||
|
||||
Respects `PIPELINE_ENABLED` setting.
|
||||
Respects `PIPELINE['PIPELINE_ENABLED']` setting.
|
||||
"""
|
||||
if settings.PIPELINE_ENABLED:
|
||||
return [settings.PIPELINE_CSS[group]['output_filename']]
|
||||
if settings.PIPELINE['PIPELINE_ENABLED']:
|
||||
return [settings.PIPELINE['STYLESHEETS'][group]['output_filename']]
|
||||
else:
|
||||
return settings.PIPELINE_CSS[group]['source_filenames']
|
||||
return settings.PIPELINE['STYLESHEETS'][group]['source_filenames']
|
||||
|
||||
@staticmethod
|
||||
def get_js_dependencies(group):
|
||||
"""
|
||||
Returns list of JS dependencies belonging to `group` in settings.PIPELINE_JS.
|
||||
Returns list of JS dependencies belonging to `group` in settings.PIPELINE['JAVASCRIPT'].
|
||||
|
||||
Respects `PIPELINE_ENABLED` setting.
|
||||
Respects `PIPELINE['PIPELINE_ENABLED']` setting.
|
||||
"""
|
||||
if settings.PIPELINE_ENABLED:
|
||||
return [settings.PIPELINE_JS[group]['output_filename']]
|
||||
if settings.PIPELINE['PIPELINE_ENABLED']:
|
||||
return [settings.PIPELINE['JAVASCRIPT'][group]['output_filename']]
|
||||
else:
|
||||
return settings.PIPELINE_JS[group]['source_filenames']
|
||||
return settings.PIPELINE['JAVASCRIPT'][group]['source_filenames']
|
||||
|
||||
def vendor_js_dependencies(self):
|
||||
"""
|
||||
|
||||
@@ -275,7 +275,7 @@ class ThemePipelineMixin(PipelineMixin):
|
||||
themes = get_themes()
|
||||
|
||||
for theme in themes:
|
||||
css_packages = self.get_themed_packages(theme.theme_dir_name, settings.PIPELINE_CSS)
|
||||
css_packages = self.get_themed_packages(theme.theme_dir_name, settings.PIPELINE['STYLESHEETS'])
|
||||
|
||||
from pipeline.packager import Packager
|
||||
packager = Packager(storage=self, css_packages=css_packages)
|
||||
|
||||
@@ -57,7 +57,7 @@ def stylesheet(parser, token): # pylint: disable=unused-argument
|
||||
_, name = token.split_contents()
|
||||
except ValueError:
|
||||
raise template.TemplateSyntaxError(
|
||||
u'%r requires exactly one argument: the name of a group in the PIPELINE_CSS setting' %
|
||||
u'%r requires exactly one argument: the name of a group in the PIPELINE["STYLESHEETS"] setting' %
|
||||
token.split_contents()[0]
|
||||
)
|
||||
return ThemeStylesheetNode(name)
|
||||
@@ -72,7 +72,7 @@ def javascript(parser, token): # pylint: disable=unused-argument
|
||||
_, name = token.split_contents()
|
||||
except ValueError:
|
||||
raise template.TemplateSyntaxError(
|
||||
u'%r requires exactly one argument: the name of a group in the PIPELINE_JS setting' %
|
||||
u'%r requires exactly one argument: the name of a group in the PIPELINE["JAVASCRIPT"] setting' %
|
||||
token.split_contents()[0]
|
||||
)
|
||||
return ThemeJavascriptNode(name)
|
||||
|
||||
@@ -6,6 +6,7 @@ from __future__ import absolute_import, unicode_literals
|
||||
import uuid
|
||||
|
||||
import ddt
|
||||
from django.conf import settings
|
||||
from django.test.client import RequestFactory
|
||||
from mock import patch
|
||||
from web_fragments.fragment import Fragment
|
||||
@@ -194,13 +195,15 @@ class TestXblockUtils(SharedModuleStoreTestCase):
|
||||
"""
|
||||
Verify that `get_css_dependencies` returns correct list of files.
|
||||
"""
|
||||
pipeline_css = {
|
||||
pipeline = settings.PIPELINE.copy()
|
||||
pipeline['PIPELINE_ENABLED'] = pipeline_enabled
|
||||
pipeline['STYLESHEETS'] = {
|
||||
'style-group': {
|
||||
'source_filenames': ["a.css", "b.css", "c.css"],
|
||||
'output_filename': "combined.css"
|
||||
}
|
||||
}
|
||||
with self.settings(PIPELINE_ENABLED=pipeline_enabled, PIPELINE_CSS=pipeline_css):
|
||||
with self.settings(PIPELINE=pipeline):
|
||||
css_dependencies = get_css_dependencies("style-group")
|
||||
self.assertEqual(css_dependencies, expected_css_dependencies)
|
||||
|
||||
@@ -213,13 +216,15 @@ class TestXblockUtils(SharedModuleStoreTestCase):
|
||||
"""
|
||||
Verify that `get_js_dependencies` returns correct list of files.
|
||||
"""
|
||||
pipeline_js = {
|
||||
pipeline = settings.PIPELINE.copy()
|
||||
pipeline['PIPELINE_ENABLED'] = pipeline_enabled
|
||||
pipeline['JAVASCRIPT'] = {
|
||||
'js-group': {
|
||||
'source_filenames': ["a.js", "b.js", "c.js"],
|
||||
'output_filename': "combined.js"
|
||||
}
|
||||
}
|
||||
with self.settings(PIPELINE_ENABLED=pipeline_enabled, PIPELINE_JS=pipeline_js):
|
||||
with self.settings(PIPELINE=pipeline):
|
||||
js_dependencies = get_js_dependencies("js-group")
|
||||
self.assertEqual(js_dependencies, expected_js_dependencies)
|
||||
|
||||
|
||||
@@ -10,23 +10,23 @@ from django.conf import settings
|
||||
|
||||
def get_css_dependencies(group):
|
||||
"""
|
||||
Returns list of CSS dependencies belonging to `group` in settings.PIPELINE_JS.
|
||||
Returns list of CSS dependencies belonging to `group` in settings.PIPELINE['STYLESHEETS'].
|
||||
|
||||
Respects `PIPELINE_ENABLED` setting.
|
||||
Respects `PIPELINE['PIPELINE_ENABLED']` setting.
|
||||
"""
|
||||
if settings.PIPELINE_ENABLED:
|
||||
return [settings.PIPELINE_CSS[group]['output_filename']]
|
||||
if settings.PIPELINE['PIPELINE_ENABLED']:
|
||||
return [settings.PIPELINE['STYLESHEETS'][group]['output_filename']]
|
||||
else:
|
||||
return settings.PIPELINE_CSS[group]['source_filenames']
|
||||
return settings.PIPELINE['STYLESHEETS'][group]['source_filenames']
|
||||
|
||||
|
||||
def get_js_dependencies(group):
|
||||
"""
|
||||
Returns list of JS dependencies belonging to `group` in settings.PIPELINE_JS.
|
||||
Returns list of JS dependencies belonging to `group` in settings.PIPELINE['JAVASCRIPT'].
|
||||
|
||||
Respects `PIPELINE_ENABLED` setting.
|
||||
Respects `PIPELINE['PIPELINE_ENABLED']` setting.
|
||||
"""
|
||||
if settings.PIPELINE_ENABLED:
|
||||
return [settings.PIPELINE_JS[group]['output_filename']]
|
||||
if settings.PIPELINE['PIPELINE_ENABLED']:
|
||||
return [settings.PIPELINE['JAVASCRIPT'][group]['output_filename']]
|
||||
else:
|
||||
return settings.PIPELINE_JS[group]['source_filenames']
|
||||
return settings.PIPELINE['JAVASCRIPT'][group]['source_filenames']
|
||||
|
||||
@@ -485,7 +485,7 @@ def xblock_local_resource_url(block, uri):
|
||||
as a static asset which will use a CDN in production.
|
||||
"""
|
||||
xblock_class = getattr(block.__class__, 'unmixed_class', block.__class__)
|
||||
if settings.PIPELINE_ENABLED or not settings.REQUIRE_DEBUG:
|
||||
if settings.PIPELINE['PIPELINE_ENABLED'] or not settings.REQUIRE_DEBUG:
|
||||
return staticfiles_storage.url('xblock/resources/{package_name}/{path}'.format(
|
||||
package_name=xblock_resource_pkg(xblock_class),
|
||||
path=uri
|
||||
|
||||
Reference in New Issue
Block a user