Commit f86026f7 by Timothée Peignier

change fallback import order

parent c917ca04
try: try:
from django.contrib.staticfiles.finders import BaseStorageFinder
except ImportError:
from staticfiles.finders import BaseStorageFinder from staticfiles.finders import BaseStorageFinder
except ImportError:
from django.contrib.staticfiles.finders import BaseStorageFinder
from pipeline.storage import PipelineStorage from pipeline.storage import PipelineFinderStorage
class PipelineFinder(BaseStorageFinder): class PipelineFinder(BaseStorageFinder):
storage = PipelineStorage storage = PipelineFinderStorage
try: try:
from django.contrib.staticfiles import finders
from django.contrib.staticfiles.storage import CachedFilesMixin, StaticFilesStorage
except ImportError:
from staticfiles import finders from staticfiles import finders
from staticfiles.storage import CachedFilesMixin, StaticFilesStorage from staticfiles.storage import CachedStaticFilesStorage, StaticFilesStorage
except ImportError:
from django.contrib.staticfiles import finders
from django.contrib.staticfiles.storage import CachedStaticFilesStorage, StaticFilesStorage
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import get_storage_class from django.core.files.storage import get_storage_class
from django.utils.functional import LazyObject from django.utils.functional import LazyObject
from pipeline.conf import settings from pipeline.conf import settings
...@@ -39,11 +38,12 @@ class PipelineFinderStorage(BaseFinderStorage): ...@@ -39,11 +38,12 @@ class PipelineFinderStorage(BaseFinderStorage):
finders = finders finders = finders
class PipelineStorage(StaticFilesStorage): class PipelineStorage(PipelineFinderStorage):
def post_process(self, paths, dry_run=False, **options): def post_process(self, paths, dry_run=False, **options):
from pipeline.packager import Packager from pipeline.packager import Packager
if dry_run: if dry_run:
return [] return []
packager = Packager() packager = Packager()
for package_name in packager.packages['css']: for package_name in packager.packages['css']:
package = packager.package_for('css', package_name) package = packager.package_for('css', package_name)
...@@ -56,7 +56,7 @@ class PipelineStorage(StaticFilesStorage): ...@@ -56,7 +56,7 @@ class PipelineStorage(StaticFilesStorage):
return super(PipelineStorage, self).post_process(paths, dry_run, **options) return super(PipelineStorage, self).post_process(paths, dry_run, **options)
class PipelineCachedStorage(CachedFilesMixin, PipelineStorage): class PipelineCachedStorage(PipelineStorage, CachedStaticFilesStorage):
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment