mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-03-16 22:40:25 +00:00
commit
18fd9abcc8
12 changed files with 31 additions and 22 deletions
|
|
@ -4,14 +4,17 @@ env:
|
|||
- TOXENV=py27-django16
|
||||
- TOXENV=py27-django17
|
||||
- TOXENV=py27-django18
|
||||
- TOXENV=py27-django19
|
||||
- TOXENV=py33-django15
|
||||
- TOXENV=py33-django16
|
||||
- TOXENV=py33-django17
|
||||
- TOXENV=py33-django18
|
||||
- TOXENV=py34-django15
|
||||
- TOXENV=py34-django16
|
||||
- TOXENV=py34-django17
|
||||
- TOXENV=py34-django18
|
||||
- TOXENV=py34-django19
|
||||
- TOXENV=py35-django18
|
||||
- TOXENV=py35-django19
|
||||
- TOXENV=flake8
|
||||
- TOXENV=sphinx
|
||||
- TOXENV=readme
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ future releases, check `milestones`_ and :doc:`/about/vision`.
|
|||
1.9 (unreleased)
|
||||
----------------
|
||||
|
||||
- Nothing changed yet.
|
||||
- Feature #112 - Introduced support of Django 1.9.
|
||||
|
||||
- Feature #113 - Introduced support of Python 3.5.
|
||||
|
||||
|
||||
1.8 (2015-07-20)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ from django_downloadview import HTTPDownloadView
|
|||
class SimpleURLDownloadView(HTTPDownloadView):
|
||||
def get_url(self):
|
||||
"""Return URL of hello-world.txt file on GitHub."""
|
||||
return 'https://raw.githubusercontent.com/benoitbryon/django-downloadview' \
|
||||
return 'https://raw.githubusercontent.com' \
|
||||
'/benoitbryon/django-downloadview' \
|
||||
'/b7f660c5e3f37d918b106b02c5af7a887acc0111' \
|
||||
'/demo/demoproject/download/fixtures/hello-world.txt'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
{% load url from future %}
|
||||
<html>
|
||||
<head>
|
||||
<title>django-downloadview demo</title>
|
||||
|
|
|
|||
|
|
@ -14,12 +14,14 @@ framework.
|
|||
"""
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "%s.settings" % __package__)
|
||||
|
||||
# This application object is used by any WSGI server configured to use this
|
||||
# file. This includes Django's development server, if the WSGI_APPLICATION
|
||||
# setting points here.
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
application = get_wsgi_application()
|
||||
|
||||
# Apply WSGI middleware here.
|
||||
|
|
|
|||
|
|
@ -29,6 +29,5 @@ class XAccelRedirectResponse(ProxiedDownloadResponse):
|
|||
elif expires is not None: # We explicitely want it off.
|
||||
self['X-Accel-Expires'] = 'off'
|
||||
if limit_rate is not None:
|
||||
self['X-Accel-Limit-Rate'] = (limit_rate
|
||||
and '%d' % limit_rate
|
||||
or 'off')
|
||||
self['X-Accel-Limit-Rate'] = \
|
||||
limit_rate and '%d' % limit_rate or 'off'
|
||||
|
|
|
|||
|
|
@ -150,8 +150,8 @@ class DownloadResponseValidator(object):
|
|||
'attachment;' in response['Content-Disposition'])
|
||||
else:
|
||||
test_case.assertTrue(
|
||||
'Content-Disposition' not in response
|
||||
or 'attachment;' not in response['Content-Disposition'])
|
||||
'Content-Disposition' not in response or
|
||||
'attachment;' not in response['Content-Disposition'])
|
||||
|
||||
|
||||
def assert_download_response(test_case, response, **assertions):
|
||||
|
|
|
|||
|
|
@ -75,6 +75,6 @@ Here are main differences between the two projects:
|
|||
.. target-notes::
|
||||
|
||||
.. _`django.contrib.staticfiles provides a view to serve files`:
|
||||
https://docs.djangoproject.com/en/1.6/ref/contrib/staticfiles/#static-file-development-view
|
||||
https://docs.djangoproject.com/en/1.9/ref/contrib/staticfiles/#static-file-development-view
|
||||
.. _`Django ticket #2131`: https://code.djangoproject.com/ticket/2131
|
||||
.. _`django-sendfile`: http://pypi.python.org/pypi/django-sendfile
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
File wrappers
|
||||
#############
|
||||
|
||||
.. py:module:: django_downloadview.files
|
||||
.. module:: django_downloadview.files
|
||||
|
||||
A view return :class:`~django_downloadview.response.DownloadResponse` which
|
||||
itself carries a file wrapper. Here are file wrappers distributed by Django
|
||||
|
|
@ -16,15 +16,15 @@ Django's builtins
|
|||
`Django itself provides some file wrappers`_ you can use within
|
||||
``django-downloadview``:
|
||||
|
||||
* :py:class:`django.core.files.File` wraps a file that live on local
|
||||
* :class:`django.core.files.File` wraps a file that live on local
|
||||
filesystem, initialized with a path. ``django-downloadview`` uses this
|
||||
wrapper in :doc:`/views/path`.
|
||||
|
||||
* :py:class:`django.db.models.fields.files.FieldFile` wraps a file that is
|
||||
* :class:`django.db.models.fields.files.FieldFile` wraps a file that is
|
||||
managed in a model. ``django-downloadview`` uses this wrapper in
|
||||
:doc:`/views/object`.
|
||||
|
||||
* :py:class:`django.core.files.base.ContentFile` wraps a bytes, string or
|
||||
* :class:`django.core.files.base.ContentFile` wraps a bytes, string or
|
||||
unicode object. You may use it with :doc:`VirtualDownloadView
|
||||
</views/virtual>`.
|
||||
|
||||
|
|
@ -127,4 +127,4 @@ TextIteratorIO
|
|||
.. target-notes::
|
||||
|
||||
.. _`Django itself provides some file wrappers`:
|
||||
https://docs.djangoproject.com/en/1.5/ref/files/file/
|
||||
https://docs.djangoproject.com/en/1.9/ref/files/file/
|
||||
|
|
|
|||
1
setup.py
1
setup.py
|
|
@ -42,6 +42,7 @@ CLASSIFIERS = [
|
|||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3.3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
]
|
||||
KEYWORDS = ['file',
|
||||
'stream',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Test suite around :mod:`django_downloadview.api` and deprecation plan."""
|
||||
from importlib import import_module
|
||||
import unittest
|
||||
from six.moves import reload_module as reload
|
||||
import warnings
|
||||
|
|
@ -7,7 +8,6 @@ import warnings
|
|||
from django.core.exceptions import ImproperlyConfigured
|
||||
import django.test
|
||||
from django.test.utils import override_settings
|
||||
from django.utils.importlib import import_module
|
||||
|
||||
|
||||
class APITestCase(unittest.TestCase):
|
||||
|
|
|
|||
12
tox.ini
12
tox.ini
|
|
@ -1,17 +1,19 @@
|
|||
[tox]
|
||||
envlist = py{27,33,34}-django{15,16,17,18}, flake8, sphinx, readme
|
||||
envlist = py{27}-django{15,16,17,18,19}, py{33,34}-django{15,16,17}, py{34,35}-django{18,19}, flake8, sphinx, readme
|
||||
|
||||
[testenv]
|
||||
basepython =
|
||||
py27: python2.7
|
||||
py33: python3.3
|
||||
py34: python3.4
|
||||
py35: python3.5
|
||||
deps =
|
||||
coverage
|
||||
django15: Django>=1.5,<1.6
|
||||
django16: Django>=1.6,<1.7
|
||||
django17: Django>=1.7,<1.8
|
||||
django18: Django>=1.8,<1.9
|
||||
django19: Django>=1.9,<1.10
|
||||
nose
|
||||
py27: mock
|
||||
commands =
|
||||
|
|
@ -22,14 +24,14 @@ commands =
|
|||
pip freeze
|
||||
|
||||
[testenv:flake8]
|
||||
basepython = python2.7
|
||||
basepython = python3.5
|
||||
deps =
|
||||
flake8
|
||||
commands =
|
||||
flake8 demo django_downloadview tests
|
||||
|
||||
[testenv:sphinx]
|
||||
basepython = python2.7
|
||||
basepython = python3.5
|
||||
deps =
|
||||
Sphinx
|
||||
commands =
|
||||
|
|
@ -39,7 +41,7 @@ whitelist_externals =
|
|||
make
|
||||
|
||||
[testenv:readme]
|
||||
basepython = python2.7
|
||||
basepython = python3.5
|
||||
deps =
|
||||
docutils
|
||||
pygments
|
||||
|
|
@ -51,7 +53,7 @@ whitelist_externals =
|
|||
mkdir
|
||||
|
||||
[testenv:release]
|
||||
basepython = python2.7
|
||||
basepython = python3.5
|
||||
deps =
|
||||
wheel
|
||||
zest.releaser
|
||||
|
|
|
|||
Loading…
Reference in a new issue