diff --git a/.travis.yml b/.travis.yml index b207d50..e623329 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CHANGELOG b/CHANGELOG index 13ec980..5877564 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/demo/demoproject/http/views.py b/demo/demoproject/http/views.py index c8e1057..dc1e7b5 100644 --- a/demo/demoproject/http/views.py +++ b/demo/demoproject/http/views.py @@ -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' diff --git a/demo/demoproject/templates/home.html b/demo/demoproject/templates/home.html index b46d3cd..ff37d40 100644 --- a/demo/demoproject/templates/home.html +++ b/demo/demoproject/templates/home.html @@ -1,4 +1,3 @@ -{% load url from future %} django-downloadview demo diff --git a/demo/demoproject/wsgi.py b/demo/demoproject/wsgi.py index 8b54e15..6135784 100755 --- a/demo/demoproject/wsgi.py +++ b/demo/demoproject/wsgi.py @@ -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. diff --git a/django_downloadview/nginx/response.py b/django_downloadview/nginx/response.py index 727db2c..4bbf0d4 100644 --- a/django_downloadview/nginx/response.py +++ b/django_downloadview/nginx/response.py @@ -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' diff --git a/django_downloadview/test.py b/django_downloadview/test.py index 627adb5..08f6ce9 100644 --- a/django_downloadview/test.py +++ b/django_downloadview/test.py @@ -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): diff --git a/docs/about/alternatives.txt b/docs/about/alternatives.txt index 9445750..140ce87 100644 --- a/docs/about/alternatives.txt +++ b/docs/about/alternatives.txt @@ -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 diff --git a/docs/files.txt b/docs/files.txt index e7f88bb..ac451ad 100644 --- a/docs/files.txt +++ b/docs/files.txt @@ -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 `. @@ -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/ diff --git a/setup.py b/setup.py index fdc3f3f..f290828 100644 --- a/setup.py +++ b/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', diff --git a/tests/api.py b/tests/api.py index ce2ebfc..f50dccc 100644 --- a/tests/api.py +++ b/tests/api.py @@ -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): diff --git a/tox.ini b/tox.ini index f466cdc..85408af 100644 --- a/tox.ini +++ b/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