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

Fix DropBoxStorage.url #357

Merged
merged 1 commit into from
Jul 7, 2017
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
django-storages change log
==========================

1.6.4 (XXXX-XX-XX)
******************

* Fix ``DropBoxStorage.url`` to work. (`#357`_)

.. _#357: https://github.com/jschneier/django-storages/pull/357

1.6.3 (2017-06-23)
******************

Expand Down
2 changes: 1 addition & 1 deletion storages/backends/dropbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def accessed_time(self, name):

def url(self, name):
media = self.client.files_get_temporary_link(self._full_path(name))
return media['link']
return media.link

def _open(self, name, mode='rb'):
remote_file = DropBoxFile(self._full_path(name), self)
Expand Down
12 changes: 7 additions & 5 deletions tests/test_dropbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
import mock


class F(object):
pass


FILE_DATE = datetime(2015, 8, 24, 15, 6, 41)
FILE_FIXTURE = {
'bytes': 4,
Expand Down Expand Up @@ -52,10 +56,8 @@
'size': '0 bytes',
'thumb_exists': False
}
FILE_MEDIA_FIXTURE = {
'link': 'https://dl.dropboxusercontent.com/1/view/foo',
'expires': 'Fri, 16 Sep 2011 01:01:25 +0000',
}
FILE_MEDIA_FIXTURE = F()
FILE_MEDIA_FIXTURE.link = 'https://dl.dropboxusercontent.com/1/view/foo'


class DropBoxTest(TestCase):
Expand Down Expand Up @@ -123,7 +125,7 @@ def test_save(self, *args):
return_value=FILE_MEDIA_FIXTURE)
def test_url(self, *args):
url = self.storage.url('foo')
self.assertEqual(url, FILE_MEDIA_FIXTURE['link'])
self.assertEqual(url, FILE_MEDIA_FIXTURE.link)

def test_formats(self, *args):
self.storage = dropbox.DropBoxStorage('foo')
Expand Down