From 58cf4bac7d831babfdeea61dc215a1993227a726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Bryon?= Date: Wed, 6 Feb 2013 19:15:00 +0100 Subject: [PATCH] Removed deprecated DownloadView. Replaced by PathDownloadView and StorageDownloadView. --- django_downloadview/__init__.py | 5 ++++- django_downloadview/views.py | 28 ---------------------------- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/django_downloadview/__init__.py b/django_downloadview/__init__.py index b09a8b1..5416895 100644 --- a/django_downloadview/__init__.py +++ b/django_downloadview/__init__.py @@ -1,5 +1,8 @@ """django-downloadview provides generic download views for Django.""" -from django_downloadview.views import DownloadView, ObjectDownloadView +# Shortcut import. +from django_downloadview.views import (PathDownloadView, + ObjectDownloadView, + StorageDownloadView) pkg_resources = __import__('pkg_resources') diff --git a/django_downloadview/views.py b/django_downloadview/views.py index 60a0275..a8e7f6b 100644 --- a/django_downloadview/views.py +++ b/django_downloadview/views.py @@ -128,34 +128,6 @@ class VirtualDownloadView(): file_obj = None -class DownloadView(BaseDownloadView): - """Download a file from storage and filename.""" - #: Server-side name (including path) of the file to serve. - #: - #: If ``storage`` is not None, then the filename will be passed to the - #: storage, else filename is supposed to be an absolute filename of a file - #: located on the local filesystem. - filename = None - - #: Storage to use to fetch the file. - #: - #: Defaults to Django's DefaultStorage(), which itself defaults to a - #: FileSystemStorage relative to settings.MEDIA_ROOT. - #: - #: The ``storage`` can be set to None, but you should use one. As an - #: example, storage classes may encapsulate some security checks - #: (FileSystemStorage actually refuses to serve files outside its root - #: location). - storage = DefaultStorage() - - def get_file(self): - """Use filename and storage to return file object to serve.""" - if self.storage: - return StorageFile(self.storage, self.filename) - else: - return File(open(self.filename)) - - class ObjectDownloadView(DownloadMixin, BaseDetailView): """Download view for models which contain a FileField.