mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-03-16 22:40:25 +00:00
PathDownloadView.get_file() makes a single call to PathDownloadView.get_path() (was doing it twice). Thanks @rleonhardt. Closes #103
This commit is contained in:
commit
ea033b8eb2
3 changed files with 12 additions and 6 deletions
|
|
@ -8,12 +8,17 @@ future releases, check `milestones`_ and :doc:`/about/vision`.
|
|||
1.8 (unreleased)
|
||||
----------------
|
||||
|
||||
- Nothing changed yet.
|
||||
Bugfixes.
|
||||
|
||||
- Bugfix #103 - ``PathDownloadView.get_file()`` makes a single call to
|
||||
``PathDownloadView.get_file()`` (was doing it twice).
|
||||
|
||||
|
||||
1.7 (2015-06-13)
|
||||
----------------
|
||||
|
||||
Bugfixes.
|
||||
|
||||
- Bugfix #87 - Filenames with commas are now supported. In download responses,
|
||||
filename is now surrounded by double quotes.
|
||||
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@ class PathDownloadView(BaseDownloadView):
|
|||
filename = self.get_path()
|
||||
if not os.path.isfile(filename):
|
||||
raise FileNotFound('File "{0}" does not exists'.format(filename))
|
||||
return File(open(self.get_path(), 'rb'))
|
||||
return File(open(filename, 'rb'))
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class DownloadMixinTestCase(unittest.TestCase):
|
|||
self.assertIs(
|
||||
mixin.was_modified_since(file_wrapper, mock.sentinel.since),
|
||||
mock.sentinel.was_modified)
|
||||
file_wrapper.was_modified_since.assertCalledOnceWith(
|
||||
file_wrapper.was_modified_since.assert_called_once_with(
|
||||
mock.sentinel.since)
|
||||
|
||||
def test_was_modified_since_django(self):
|
||||
|
|
@ -101,9 +101,10 @@ class DownloadMixinTestCase(unittest.TestCase):
|
|||
self.assertIs(
|
||||
mixin.was_modified_since(file_wrapper, mock.sentinel.since),
|
||||
mock.sentinel.was_modified)
|
||||
was_modified_since_mock.assertCalledOnceWith(
|
||||
mock.sentinel.size,
|
||||
mock.sentinel.modified_time)
|
||||
was_modified_since_mock.assert_called_once_with(
|
||||
mock.sentinel.since,
|
||||
mock.sentinel.modified_time,
|
||||
mock.sentinel.size)
|
||||
|
||||
def test_was_modified_since_fallback(self):
|
||||
"""DownloadMixin.was_modified_since() fallbacks to `True`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue