Skip to content

Commit 64aa717

Browse files
kennethlovesbywaterbmispelon
authored
Next release (#257)
* Update README.md Updates Supported Django Versions section. * Tox now only tests recent Pythons and Djangos * Include necessary files to build docs in source tarball. Closes #250 * Fixes deprecated imports, adds `six` as requirement * force text to prevent Python 2 unicode fun * Added --nomigrations option to pytest For some reason this makes the tests work on my machine (thanks Baptiste!) * Have to specify a non-breaking version of semantic-version (lol) * Update CONTRIBUTORS.txt * Release date Co-authored-by: Steve Bywater <[email protected]> Co-authored-by: Baptiste Mispelon <[email protected]>
1 parent 117c654 commit 64aa717

24 files changed

+161
-83
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ dist/
1313
.idea
1414
build/
1515
venv/
16+
.pytest_cache/

.travis.yml

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: python
2-
services: sqlite
2+
services:
3+
- sqlite
34
cache:
45
directories:
56
- $HOME/.cache/pip
@@ -9,21 +10,27 @@ matrix:
910
include:
1011
- python: 2.7
1112
env: TOX_ENV=py27-django111
12-
- python: 3.4
13-
env: TOX_ENV=py34-django111
14-
- python: 3.4
15-
env: TOX_ENV=py34-django20
16-
- python: 3.5
17-
env: TOX_ENV=py35-django111
18-
- python: 3.5
19-
env: TOX_ENV=py35-django20
2013
- python: 3.6
2114
env: TOX_ENV=py36-django111
2215
- python: 3.6
23-
env: TOX_ENV=py36-django20
16+
env: TOX_ENV=py36-django22
17+
- python: 3.6
18+
env: TOX_ENV=py36-django30
19+
- python: 3.7
20+
env: TOX_ENV=py37-django111
21+
- python: 3.7
22+
env: TOX_ENV=py37-django22
23+
- python: 3.7
24+
env: TOX_ENV=py37-django30
25+
- python: 3.8
26+
env: TOX_ENV=py38-django111
27+
- python: 3.8
28+
env: TOX_ENV=py38-django22
29+
- python: 3.8
30+
env: TOX_ENV=py38-django30
2431

2532
script: tox -e $TOX_ENV
2633

2734
install:
2835
- pip install pip setuptools wheel -U
29-
- pip install tox
36+
- pip install tox tox-travis

CONTRIBUTORS.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ Direct Contributors
3636
Other Contributors
3737
==================
3838

39-
* The entire Python and Django communities for providing us the tools and desire we to build these things.
39+
* The entire Python and Django communities for providing us the tools
40+
and desire to build these things.

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include README.md
22
include LICENSE
33
include CONTRIBUTORS.txt
44
recursive-include braces *.py
5-
recursive-include docs *.rst
5+
recursive-include docs Makefile conf.py *.rst
66
recursive-include tests *.py
77
recursive-include tests/templates *.html
88
include conftest.py tox.ini requirements.txt

README.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# django-braces
2+
23
Mixins for Django's class-based views.
34

45
[![Latest Travis CI status](https://travis-ci.org/brack3t/django-braces.svg)](https://travis-ci.org/brack3t/django-braces)
@@ -25,15 +26,21 @@ Add yourself to `CONTRIBUTORS.txt` if you want.
2526

2627
All development dependencies are available in `requirements.txt` file.
2728

28-
To run the test suite, execute the following in your shell (Django install is required):
29-
`py.test tests/ --cov=braces --cov-report=html`
29+
To run the test suite, please install `tox` and as many Python interpreters as you'd
30+
like to test against. Currently we test against 2.7, 3.6, 3.7, and 3.8. We recommend
31+
using `asdf` to install various Python versions.
32+
33+
Once `tox` and Python(s) are installed, you can execute the entire suite by running
34+
just the `tox` command.
3035

31-
Or test with `tox` if you have `tox` installed.
3236

3337
## Change Log
3438

3539
[Changelog on Read The Docs](https://django-braces.readthedocs.io/en/latest/changelog.html)
3640

3741
## Supported Django Versions
3842

39-
Our policy is that `django-braces` officially supports the current version of Django and one version each direction (e.g. 1.6.x is current, so 1.5.x, 1.6.x, and 1.7.x are all supported). There won't be any restraints on using other versions of Django, though, but it will be a "buyer beware" situation.
43+
Our policy is that `django-braces` officially supports, and is tested on, all versions
44+
that Django [officially supports](https://www.djangoproject.com/download/#supported-versions).
45+
You are free to use `django-braces` with any version of Django you wish (so long as it has
46+
class-based views) but no support will be promised.

braces/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"""
1010

1111
__title__ = 'braces'
12-
__version__ = '1.13.0'
12+
__version__ = '1.14.0'
1313
__author__ = 'Kenneth Love and Chris Jones'
1414
__license__ = 'BSD 3-clause'
1515
__copyright__ = 'Copyright 2013 Kenneth Love and Chris Jones'

braces/views/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
MessageMixin,
2727
SuccessURLRedirectListMixin,
2828
UserFormKwargsMixin,
29-
_MessageAPIWrapper
3029
)
3130
from ._other import (
3231
AllVerbsMixin,

braces/views/_access.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
from django.http import (HttpResponseRedirect, HttpResponsePermanentRedirect,
1010
Http404, HttpResponse, StreamingHttpResponse)
1111
from django.shortcuts import resolve_url
12-
from django.utils import six
13-
from django.utils.encoding import force_text
12+
try:
13+
from django.utils.encoding import force_str as force_string
14+
except ImportError:
15+
from django.utils.encoding import force_text as force_string
1416
from django.utils.timezone import now
1517

18+
import six
19+
1620

1721
class AccessMixin(object):
1822
"""
@@ -34,7 +38,7 @@ def get_login_url(self):
3438
'Define {0}.login_url or settings.LOGIN_URL or override '
3539
'{0}.get_login_url().'.format(self.__class__.__name__))
3640

37-
return force_text(login_url)
41+
return force_string(login_url)
3842

3943
def get_redirect_field_name(self):
4044
"""

braces/views/_ajax.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from django.core.exceptions import ImproperlyConfigured
66
from django.core.serializers.json import DjangoJSONEncoder
77
from django.http import HttpResponse, HttpResponseBadRequest
8-
from django.utils import six
8+
9+
import six
910

1011

1112
class JSONResponseMixin(object):

braces/views/_forms.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1+
from functools import partial
2+
13
from django.contrib import messages
24
from django.core.exceptions import ImproperlyConfigured
3-
from django.utils import six
45
from django.utils.decorators import method_decorator
5-
from django.utils.encoding import force_text
6-
from django.utils.functional import curry, Promise
6+
try:
7+
from django.utils.encoding import force_str as force_string
8+
except ImportError:
9+
from django.utils.encoding import force_text as force_string
10+
from django.utils.functional import Promise
711
from django.views.decorators.csrf import csrf_exempt
812
try:
913
from django.urls import reverse
1014
except ImportError:
1115
from django.core.urlresolvers import reverse
1216

17+
import six
18+
1319

1420
class CsrfExemptMixin(object):
1521
"""
@@ -73,7 +79,7 @@ class _MessageAPIWrapper(object):
7379
def __init__(self, request):
7480
for name in self.API:
7581
api_fn = getattr(messages.api, name)
76-
setattr(self, name, curry(api_fn, request))
82+
setattr(self, name, partial(api_fn, request))
7783

7884

7985
class _MessageDescriptor(object):
@@ -121,7 +127,7 @@ def get_form_valid_message(self):
121127
'object.'.format(self.__class__.__name__)
122128
)
123129

124-
return force_text(self.form_valid_message)
130+
return force_string(self.form_valid_message)
125131

126132
def form_valid(self, form):
127133
"""
@@ -166,7 +172,7 @@ def get_form_invalid_message(self):
166172
'{0}.form_invalid_message must be a str or unicode '
167173
'object.'.format(self.__class__.__name__))
168174

169-
return force_text(self.form_invalid_message)
175+
return force_string(self.form_invalid_message)
170176

171177
def form_invalid(self, form):
172178
response = super(FormInvalidMessageMixin, self).form_invalid(form)

braces/views/_other.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from django.core.exceptions import ImproperlyConfigured
22
from django.shortcuts import redirect
3-
from django.utils.encoding import force_text
3+
try:
4+
from django.utils.encoding import force_str as force_string
5+
except ImportError:
6+
from django.utils.encoding import force_text as force_string
47
try:
58
from django.urls import resolve
69
except ImportError:
@@ -28,7 +31,7 @@ def get_headline(self):
2831
'{0} is missing a headline. '
2932
'Define {0}.headline, or override '
3033
'{0}.get_headline().'.format(self.__class__.__name__))
31-
return force_text(self.headline)
34+
return force_string(self.headline)
3235

3336

3437
class StaticContextMixin(object):

docs/changelog.rst

+23-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,35 @@
44
Changelog
55
=========
66

7+
* :release:`1.14.0 <2019-12-30>`
8+
* :support:`260` Fixes the goshdang Travis tests.
9+
* :support:`250` Include documentation Makefile and conf.py in source distribution.
10+
* :support:`246` README more accurately explains the supported Django versions.
11+
* :release:`1.13.0 <2018-04-06>`
12+
* :support:`243` Adds support for Python 3.7 and Django 2.1.
13+
* :support:`244` Documentation link fix.
14+
* :support:`236` Refines the Django and Python versions tested against.
15+
* :support:`241` Fixes a documentation typo, "altenate" should be "alternate".
16+
* :release:`1.12.0 <2018-04-06>`
17+
* :support:`237` Updates for Django 2.0.
18+
* :support:`232` Updates for Django 1.11.
19+
* :support:`227` Use SVG in README instead of PNG.
20+
* :support:`221` Renamed a duplicative method name.
21+
* :support:`220` Adds a warning for cases where ``prefetch_related`` or ``select_related`` are empty in their respective mixins.
22+
* :release:`1.11.0 <2017-02-01>`
23+
* :bug:`215 major` Imports for 1.11 and 2.x ``reverse`` and ``reverse_lazy`` functions.
24+
* :support:`248` Include some files necessary for testing in the source distribution.
25+
* :feature:`228` Adds an ``object_level_permissions`` attribute to the ``PermissionRequiredMixin`` to allow for object-level permission checks instead of just view-level checks.
26+
* :bug:`224 major` Allows ``OPTIONS`` requests to be body-less.
27+
* :bug:`218 major` ``AccessMixin.handle_no_permission` now accepts a ``request`` parameter.
728
* :feature:`198` New :ref:`OrderableListMixin` allows to switch the default ordering setting from `asc` to `desc`.
829
* :support:`215` Imports updated for Django 2.0.
930
* :feature:`204` New :ref:`HeaderMixin` that allows custom headers to be set on a view.
1031
* :release:`1.10.0 <2016-10-24>`
1132
* :bug:`212 major` Small changes for Django 1.10 compatibility.
1233
* :bug:`211 major` ReadTheDocs links updated.
1334
* :bug:`209 major` Django documentation link updated.
14-
* :release:`1.9.0 <2016-5-31>`
35+
* :release:`1.9.0 <2016-05-31>`
1536
* :bug:`208 major` Fixed errors from combining certain access mixins.
1637
* :bug:`196 major` Refactor how users without permissions are handled.
1738
* :bug:`181 major` Fixed redirect loops based on user permissions.
@@ -21,7 +42,7 @@ Changelog
2142
* :support:`202` Fixed typo in ``PermissionsRequiredMixin`` and ``MultiplePermissionsRequiredMixin``.
2243
* :support:`201` Fixed typo in ``SuccessURLRedirectListMixin``.
2344
* :support:`192` Added example for ``OrderableListView``.
24-
* :release:`1.8.1 <2015-7-12>`
45+
* :release:`1.8.1 <2015-07-12>`
2546
* :bug:`176` Only check time delta for authenticated users in :ref:`RecentLoginRequiredMixin`.
2647
* :bug:`-` Changed :ref:`JsonRequestResponseMixin` docs to not use `ugettext_lazy`.
2748
* :bug:`-` Updated tests to include Python 3.2.

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
releases_issue_uri = "https://github.com/brack3t/django-braces/issues/%s"
3535
releases_release_uri = "https://github.com/brack3t/django-braces/tree/%s"
3636
releases_unstable_prehistory = True
37-
# releases_debug = True
37+
releases_debug = True
3838

3939
# Add any paths that contain templates here, relative to this directory.
4040
templates_path = ['_templates']

requirements-docs.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
sphinx
1+
sphinx==1.7.9
22
releases
3+
semantic-version==2.6

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.13.0
2+
current_version = 1.14.0
33
commit = True
44
tag = True
55

setup.py

+4
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@
2929
"Framework :: Django :: 1.11",
3030
"Framework :: Django :: 2.0"
3131
],
32+
install_requires=[
33+
"Django>=1.11.0",
34+
"six"
35+
],
3236
)

tests/compat.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
try:
2-
from django.utils.encoding import force_text
2+
from django.utils.encoding import force_str as force_string
33
except ImportError:
4-
from django.utils.encoding import force_unicode as force_text
4+
from django.utils.encoding import force_text as force_string
55

66
try:
77
from django.conf.urls import url, include

tests/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
DATABASES = {
1717
'default': {
1818
'ENGINE': 'django.db.backends.sqlite3',
19-
'NAME': ':memory:',
19+
'NAME': ':memory:'
2020
}
2121
}
2222

0 commit comments

Comments
 (0)