Skip to content

Commit

Permalink
Drop Python 2.7 and Django 1.11 support
Browse files Browse the repository at this point in the history
* Stop testing against Python 2.7 and Django 1.11
* Remove six
* Remove Python 2 from trove classifiers

Fixes #17
  • Loading branch information
moggers87 committed Nov 30, 2019
1 parent 00213db commit 0b704aa
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 17 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ language: python
dist: xenial

python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- pypy2.7-6.0
- pypy3.5-6.0

install: travis_retry pip install -q tox
Expand Down
6 changes: 1 addition & 5 deletions sendfile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.http import Http404
from django.utils.encoding import force_text
from django.utils.http import urlquote
import six

from ._version import get_versions

Expand Down Expand Up @@ -89,10 +88,7 @@ def sendfile(request, filename, attachment=False, attachment_filename=None,
if attachment_filename:
attachment_filename = force_text(attachment_filename)
ascii_filename = unicodedata.normalize('NFKD', attachment_filename)
ascii_filename = ascii_filename.encode('ascii', 'ignore')

if six.PY3:
ascii_filename = ascii_filename.decode()
ascii_filename = ascii_filename.encode('ascii', 'ignore').decode()
parts.append('filename="%s"' % ascii_filename)

if ascii_filename != attachment_filename:
Expand Down
6 changes: 1 addition & 5 deletions sendfile/backends/xsendfile.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from django.http import HttpResponse
import six


def sendfile(request, filename, **kwargs):
filename = six.text_type(filename)
if six.PY2:
filename = filename.encode("utf-8")

filename = str(filename)
response = HttpResponse()
response['X-Sendfile'] = filename

Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
url='https://github.com/moggers87/django-sendfile2',
license='BSD',

install_requires=['django', 'six'],
install_requires=['django'],
packages=['sendfile', 'sendfile.backends'],
package_dir={
'sendfile': 'sendfile',
Expand All @@ -35,8 +35,6 @@
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
Expand Down
2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
[tox]
envlist =
py{py,27,py3,35,36,37}-django111
py{py3,35,36,37,38}-django{21,22}
flake8

[testenv]
usedevelop=True
deps =
django111: Django>=1.11,<1.12
django21: Django>=2.1,<2.2
django22: Django>=2.2,<2.3
changedir = examples/protected_downloads
Expand Down

0 comments on commit 0b704aa

Please sign in to comment.