Skip to content
This repository was archived by the owner on Oct 6, 2020. It is now read-only.

Commit 6927513

Browse files
committed
Merge pull request johnsensible#28 from NotSqrt/master
2 parents daa294a + 31ceca3 commit 6927513

File tree

11 files changed

+59
-40
lines changed

11 files changed

+59
-40
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
/lib
1010
/build
1111
.Python
12+
.tox

examples/protected_downloads/download/tests.py

-16
This file was deleted.

examples/protected_downloads/example/__init__.py

Whitespace-only changes.

examples/protected_downloads/settings.py examples/protected_downloads/example/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
'django.contrib.auth.middleware.AuthenticationMiddleware',
6868
)
6969

70-
ROOT_URLCONF = 'protected_downloads.urls'
70+
ROOT_URLCONF = 'example.urls'
7171

7272
TEMPLATE_DIRS = (
7373
os.path.join(PROJECT_ROOT, 'templates'),
+6-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
#!/usr/bin/env python
2+
import os
3+
import sys
24

3-
from __future__ import absolute_import
5+
if __name__ == "__main__":
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
47

5-
from django.core.management import execute_manager
6-
try:
7-
from . import settings # Assumed to be in the same directory.
8-
except ImportError:
9-
import sys
10-
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
11-
sys.exit(1)
8+
from django.core.management import execute_from_command_line
129

13-
if __name__ == "__main__":
14-
execute_manager(settings)
10+
execute_from_command_line(sys.argv)

examples/protected_downloads/sendfile

-1
This file was deleted.

sendfile/tests.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# coding=utf-8
22

3+
from __future__ import unicode_literals
4+
35
from django.conf import settings
46
from django.test import TestCase
57
from django.http import HttpResponse, Http404, HttpRequest
@@ -107,7 +109,7 @@ def test_correct_file_in_xsendfile_header(self):
107109
self.assertEqual(filepath, response['X-Sendfile'])
108110

109111
def test_xsendfile_header_containing_unicode(self):
110-
filepath = self.ensure_file(u'péter_là_gueule.txt')
112+
filepath = self.ensure_file('péter_là_gueule.txt')
111113
response = real_sendfile(HttpRequest(), filepath)
112114
self.assertTrue(response is not None)
113115
self.assertEqual(smart_str(filepath), response['X-Sendfile'])
@@ -129,7 +131,7 @@ def test_correct_url_in_xaccelredirect_header(self):
129131
self.assertEqual('/private/readme.txt', response['X-Accel-Redirect'])
130132

131133
def test_xaccelredirect_header_containing_unicode(self):
132-
filepath = self.ensure_file(u'péter_là_gueule.txt')
134+
filepath = self.ensure_file('péter_là_gueule.txt')
133135
response = real_sendfile(HttpRequest(), filepath)
134136
self.assertTrue(response is not None)
135137
self.assertEqual(u'/private/péter_là_gueule.txt'.encode('utf-8'), unquote(response['X-Accel-Redirect']))

setup.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[wheel]
2+
# create "py2.py3-none-any.whl" package
3+
universal = 1

setup.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
from distutils.core import setup
2-
3-
try:
4-
from distutils.command.build_py import build_py_2to3 as build_py
5-
except ImportError:
6-
from distutils.command.build_py import build_py
1+
from setuptools import setup
72

83

94
version = __import__('sendfile').__version__
@@ -19,8 +14,8 @@
1914
url='https://github.com/johnsensible/django-sendfile',
2015
license='BSD',
2116

22-
requires=['Django (>=1.3)'],
23-
install_requires=['Django>=1.3'],
17+
requires=['Django (>=1.4.2)', 'Unidecode'],
18+
install_requires=['Django >=1.4.2', 'Unidecode'],
2419

2520
packages=['sendfile', 'sendfile.backends'],
2621
package_dir={
@@ -40,8 +35,11 @@
4035
'License :: OSI Approved :: BSD License',
4136
'Operating System :: OS Independent',
4237
'Programming Language :: Python',
38+
'Programming Language :: Python :: 2.6',
39+
'Programming Language :: Python :: 2.7',
40+
'Programming Language :: Python :: 3.2',
41+
'Programming Language :: Python :: 3.3',
42+
'Programming Language :: Python :: 3.4',
4343
'Topic :: Software Development :: Libraries :: Python Modules',
4444
],
45-
46-
cmdclass={'build_py': build_py},
4745
)

tox.ini

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Tox (http://codespeak.net/~hpk/tox/) is a tool for running tests
2+
# in multiple virtualenvs. This configuration file will run the
3+
# test suite on all supported python versions. To use it, "pip install tox"
4+
# and then run "tox" from this directory.
5+
6+
[tox]
7+
minversion=1.8.0
8+
envlist =
9+
py26-django14,
10+
py26-django15,
11+
12+
py27-django14,
13+
py27-django15,
14+
py27-django16,
15+
py27-django17,
16+
17+
py32-django15,
18+
py32-django16,
19+
py32-django17,
20+
21+
py33-django15,
22+
py33-django16,
23+
py33-django17,
24+
25+
py34-django15,
26+
py34-django16,
27+
py34-django17,
28+
29+
[testenv]
30+
changedir = examples/protected_downloads
31+
commands = python manage.py test sendfile
32+
deps =
33+
django14: django >=1.4.2,<1.5
34+
django15: django >=1.5,<1.6
35+
django16: django >=1.6,<1.7
36+
django17: django >=1.7,<1.8

0 commit comments

Comments
 (0)