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

[dropbox] Conform to location property name #1435

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
22 changes: 5 additions & 17 deletions storages/backends/dropbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Author: Anthony Monthe <anthony.monthe@gmail.com>
# License: BSD

import warnings
from io import BytesIO
from shutil import copyfileobj
from tempfile import SpooledTemporaryFile
Expand Down Expand Up @@ -79,11 +78,9 @@ def __init__(self, oauth2_access_token=None, **settings):
[self.app_key, self.app_secret, self.oauth2_refresh_token]
):
raise ImproperlyConfigured(
"You must configure an auth token at"
"'settings.DROPBOX_OAUTH2_TOKEN' or "
"'setting.DROPBOX_APP_KEY', "
"'setting.DROPBOX_APP_SECRET' "
"and 'setting.DROPBOX_OAUTH2_REFRESH_TOKEN'."
"You must configure an auth token at 'settings.DROPBOX_OAUTH2_TOKEN' "
"or 'setting.DROPBOX_APP_KEY', 'setting.DROPBOX_APP_SECRET' and "
"'setting.DROPBOX_OAUTH2_REFRESH_TOKEN'."
)
self.client = Dropbox(
self.oauth2_access_token,
Expand All @@ -92,16 +89,7 @@ def __init__(self, oauth2_access_token=None, **settings):
oauth2_refresh_token=self.oauth2_refresh_token,
timeout=self.timeout,
)

# Backwards compat
if hasattr(self, "location"):
warnings.warn(
"Setting `root_path` with name `location` is deprecated and will be "
"removed in a future version of django-storages. Please update the "
"name from `location` to `root_path`",
DeprecationWarning,
)
self.root_path = self.location
self.location = self.root_path

def get_default_settings(self):
return {
Expand All @@ -117,7 +105,7 @@ def get_default_settings(self):
def _full_path(self, name):
if name == "/":
name = ""
return safe_join(self.root_path, name).replace("\\", "/")
return safe_join(self.location, name).replace("\\", "/")

def delete(self, name):
self.client.files_delete(self._full_path(name))
Expand Down
Loading