Skip to content

Commit

Permalink
[dropbox] Conform to location property name
Browse files Browse the repository at this point in the history
  • Loading branch information
jschneier committed Jul 20, 2024
1 parent 123b9b9 commit a744bd2
Showing 1 changed file with 5 additions and 17 deletions.
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 <[email protected]>
# 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

0 comments on commit a744bd2

Please sign in to comment.