mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-03-16 22:40:25 +00:00
Avoid calling get_path() twice inside get_file
Overridden PathDownloadView.get_path() may contain database lookups and logging which should not be called twice if not necessary, as it was in my case. Because the acquired filename does not change inside get_file(), I replaced the duplicate call.
This commit is contained in:
parent
142d8de7fa
commit
75b51ce214
1 changed files with 1 additions and 1 deletions
|
|
@ -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'))
|
||||
|
|
|
|||
Loading…
Reference in a new issue