Improved support of Python-3.5 and Django-1.9. Refs #112, refs #113.

This commit is contained in:
Benoît Bryon 2016-03-14 15:40:13 +01:00
parent a3203f2298
commit 08031dab21
6 changed files with 14 additions and 9 deletions

View file

@ -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

View file

@ -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'

View file

@ -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.

View file

@ -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'

View file

@ -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):

View file

@ -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