Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dropbox.py #745

Merged
merged 3 commits into from
Feb 2, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions storages/backends/dropbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,18 @@ def _set_file(self, value):
@deconstructible
class DropBoxStorage(Storage):
"""DropBox Storage class for Django pluggable storage system."""
location = setting('DROPBOX_ROOT_PATH', '/')
oauth2_access_token = setting('DROPBOX_OAUTH2_TOKEN')
timeout = setting('DROPBOX_TIMEOUT' _DEFAULT_TIMEOUT)
jschneier marked this conversation as resolved.
Show resolved Hide resolved

CHUNK_SIZE = 4 * 1024 * 1024

def __init__(self, oauth2_access_token=None, root_path=None, timeout=None):
oauth2_access_token = oauth2_access_token or setting('DROPBOX_OAUTH2_TOKEN')
def __init__(self, oauth2_access_token=oauth2_access_token, root_path=location, timeout=timeout):
if oauth2_access_token is None:
raise ImproperlyConfigured("You must configure an auth token at"
"'settings.DROPBOX_OAUTH2_TOKEN'.")

self.root_path = root_path or setting('DROPBOX_ROOT_PATH', '/')
timeout = timeout or setting('DROPBOX_TIMEOUT', _DEFAULT_TIMEOUT)
self.root_path = root_path
self.client = Dropbox(oauth2_access_token, timeout=timeout)

def _full_path(self, name):
Expand Down