Merge pull request #11286 from open-craft/omar/remove-s3

Add OpenStack Swift support
This commit is contained in:
Braden MacDonald
2016-07-07 11:05:28 -07:00
committed by GitHub
25 changed files with 348 additions and 420 deletions

View File

@@ -3,6 +3,9 @@ Django storage backends for Open edX.
"""
from django_pipeline_forgiving.storages import PipelineForgivingStorage
from django.contrib.staticfiles.storage import StaticFilesStorage
from django.core.files.storage import get_storage_class
from django.utils.lru_cache import lru_cache
from pipeline.storage import NonPackagingMixin
from require.storage import OptimizedFilesMixin
from openedx.core.djangoapps.theming.storage import (
@@ -39,3 +42,16 @@ class DevelopmentStorage(
so that we can skip packaging and optimization.
"""
pass
@lru_cache()
def get_storage(storage_class=None, **kwargs):
"""
Returns a storage instance with the given class name and kwargs. If the
class name is not given, an instance of the default storage is returned.
Instances are cached so that if this function is called multiple times
with the same arguments, the same instance is returned. This is useful if
the storage implementation makes http requests when instantiated, for
example.
"""
return get_storage_class(storage_class)(**kwargs)