-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from ImperialCollegeLondon/feature/storage
Adding support for django-storages
- Loading branch information
Showing
39 changed files
with
3,452 additions
and
803 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
[run] | ||
omit = django_drf_filepond/__init__.py | ||
django_drf_filepond/apps.py | ||
omit = | ||
django_drf_filepond/__init__.py | ||
django_drf_filepond/apps.py | ||
|
||
[report] | ||
show_missing = True |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class ConfigurationError(Exception): | ||
''' | ||
Raised when a problem occurs with the configuration of the library. | ||
''' | ||
pass | ||
|
||
|
||
class APIError(Exception): | ||
''' | ||
Raised when a problem occurs in the API functions. | ||
''' | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import importlib | ||
import logging | ||
|
||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
|
||
def _get_storage_backend(fq_classname): | ||
""" | ||
Load the specified django-storages storage backend class. This is called | ||
regardless of whether a beckend is specified so if fq_classname is not | ||
set, we just return None. | ||
fq_classname is a string specifying the fully-qualified class name of | ||
the django-storages backend to use, e.g. | ||
'storages.backends.sftpstorage.SFTPStorage' | ||
""" | ||
LOG.debug('Running _get_storage_backend with fq_classname [%s]' | ||
% fq_classname) | ||
|
||
if not fq_classname: | ||
return None | ||
|
||
(modname, clname) = fq_classname.rsplit('.', 1) | ||
# A test import of the backend storage class should have been undertaken | ||
# at app startup in django_drf_filepond.apps.ready so any failure | ||
# importing the backend should have been picked up then. | ||
mod = importlib.import_module(modname) | ||
storage_backend = getattr(mod, clname)() | ||
LOG.info('Storage backend instance [%s] created...' % fq_classname) | ||
|
||
return storage_backend |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.