Skip to content

Commit 334a376

Browse files
authored
Merge pull request #123 from vintasoftware/feat/update-supported-python-django-versions
Update supported python and django versions
2 parents 28dcd44 + d70a0c5 commit 334a376

14 files changed

+45
-85
lines changed

.travis.yml

+7-49
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,18 @@
11
language: python
22

3-
matix:
4-
include:
5-
- python: 3.6
6-
env:
7-
- TOX_ENV=py36-flake8
8-
- python: 3.4
9-
env:
10-
- TOX_ENV=py34-django20
11-
- python: 3.5
12-
env:
13-
- TOX_ENV=py35-django20
14-
- python: 3.6
15-
env:
16-
- TOX_ENV=py36-django20
17-
- python: 3.7
18-
env:
19-
- TOX_ENV=py37-django20
20-
- python: 3.5
21-
env:
22-
- TOX_ENV=py35-django21
23-
- python: 3.6
24-
env:
25-
- TOX_ENV=py36-django21
26-
- python: 3.7
27-
env:
28-
- TOX_ENV=py37-django21
29-
- python: 3.5
30-
env:
31-
- TOX_ENV=py35-django22
32-
- python: 3.6
33-
env:
34-
- TOX_ENV=py36-django22
35-
- python: 3.7
36-
env:
37-
- TOX_ENV=py37-django22
38-
- python: 3.8
39-
env:
40-
- TOX_ENV=py38-django22
41-
- python: 3.6
42-
env:
43-
- TOX_ENV=py36-django30
44-
- python: 3.7
45-
env:
46-
- TOX_ENV=py37-django30
47-
- python: 3.8
48-
env:
49-
- TOX_ENV=py38-django30
3+
python:
4+
- "3.6"
5+
- "3.7"
6+
- "3.8"
7+
- "3.9"
508

519
install:
52-
- pip install tox
10+
- pip install tox-travis
5311
- pip install -r requirements.txt
5412
- pip install coveralls
5513

5614
script:
57-
- tox -e $TOX_ENV
15+
- tox
5816

5917
after_script:
6018
coveralls

README.rst

+13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ develop branch: https://github.com/vintasoftware/django-templated-email/blob/dev
2424

2525
stable pypi/master: https://github.com/vintasoftware/django-templated-email/blob/master/README.rst
2626

27+
28+
Requirements
29+
=================
30+
* Python (3.6, 3.7, 3.8, 3.9)
31+
* Django (2.2, 3.1, 3.2)
32+
33+
We **highly recommend** and only officially support the latest patch release of
34+
each Python and Django series.
35+
36+
2737
Getting going - installation
2838
==============================
2939

@@ -315,6 +325,7 @@ Methods:
315325
**templated_email_get_recipients(self, form)** (mandatory):
316326
Return the recipient list to whom the email will be sent to.
317327
ie:
328+
318329
.. code-block:: python
319330
320331
def templated_email_get_recipients(self, form):
@@ -324,6 +335,7 @@ Methods:
324335
Use this method to add extra data to the context used for rendering the template. You should get the parent class's context from
325336
calling super.
326337
ie:
338+
327339
.. code-block:: python
328340
329341
def templated_email_get_context_data(self, **kwargs):
@@ -334,6 +346,7 @@ Methods:
334346
**templated_email_get_send_email_kwargs(self, valid, form)** (optional):
335347
Add or change the kwargs that will be used to send the e-mail. You should call super to get the default kwargs.
336348
ie:
349+
337350
.. code-block:: python
338351
339352
def templated_email_get_send_email_kwargs(valid, form):

setup.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
pass
1212

1313
requirements = [
14-
'django-render-block>=0.5',
15-
'six>=1',
14+
'django-render-block>=0.5'
1615
]
1716

1817
# python setup.py publish
@@ -25,12 +24,10 @@
2524
'Intended Audience :: Developers',
2625
'License :: OSI Approved :: MIT License',
2726
'Operating System :: OS Independent',
28-
'Programming Language :: Python :: 2',
29-
'Programming Language :: Python :: 2.7',
30-
'Programming Language :: Python :: 3',
31-
'Programming Language :: Python :: 3.4',
32-
'Programming Language :: Python :: 3.5',
3327
'Programming Language :: Python :: 3.6',
28+
'Programming Language :: Python :: 3.7',
29+
'Programming Language :: Python :: 3.8',
30+
'Programming Language :: Python :: 3.9',
3431
'Topic :: Software Development :: Libraries :: Python Modules',
3532
'Framework :: Django',
3633
]
@@ -46,6 +43,7 @@
4643
license='MIT',
4744
description=DESCRIPTION,
4845
long_description=LONG_DESCRIPTION,
46+
long_description_content_type='text/x-rst',
4947
platforms=['any'],
5048
classifiers=CLASSIFIERS,
5149
install_requires=requirements,

templated_email/__init__.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from django.conf import settings
22
from django.utils.module_loading import import_string
33

4-
import six
5-
64
from templated_email.backends.vanilla_django import TemplateBackend
75
from templated_email.utils import InlineImage # noqa
86

@@ -20,7 +18,7 @@ def get_connection(backend=None, template_prefix=None, template_suffix=None,
2018
# django.core.mail.get_connection
2119
klass_path = backend or getattr(settings, 'TEMPLATED_EMAIL_BACKEND',
2220
TemplateBackend)
23-
if isinstance(klass_path, six.string_types):
21+
if isinstance(klass_path, str):
2422
try:
2523
# First check if class name is omitted and we have module in settings
2624
klass = import_string(klass_path + '.' + 'TemplateBackend')

templated_email/backends/vanilla_django.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from django.conf import settings
66
from django.core.mail import get_connection
77
from django.template import Context
8-
from django.utils.translation import ugettext as _
8+
from django.utils.translation import gettext as _
99
from django.core.files.storage import default_storage
1010

1111
from templated_email.utils import (

templated_email/migrations/0001_initial.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: utf-8 -*-
22
# Generated by Django 1.10 on 2016-10-05 17:09
3-
from __future__ import unicode_literals
43

54
from django.db import migrations, models
65
import uuid

templated_email/urls.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from django.conf.urls import url
1+
from django.urls import re_path
22

33
from templated_email.views import ShowEmailView
44

55
app_name = 'templated_email'
66
urlpatterns = [
7-
url(r'^email/(?P<uuid>([a-f\d]{32})|([a-f\d]{8}(-[a-f\d]{4}){3}-[a-f\d]{12}))/$', ShowEmailView.as_view(), name='show_email'),
7+
re_path(r'^email/(?P<uuid>([a-f\d]{32})|([a-f\d]{8}(-[a-f\d]{4}){3}-[a-f\d]{12}))/$', ShowEmailView.as_view(), name='show_email'),
88
]

templated_email/utils.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
from django.utils.module_loading import import_string
77
from django.conf import settings
88

9-
import six
10-
119

1210
def _get_klass_from_config(config_variable, default):
1311
klass_path = getattr(settings, config_variable, default)
14-
if isinstance(klass_path, six.string_types):
12+
if isinstance(klass_path, str):
1513
klass_path = import_string(klass_path)
1614

1715
return klass_path

tests/backends/test_vanilla_django_backend.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def test_send_attachment_mime_base(self, render_mock):
426426
attachments=[MIMEImage(TXT_FILE, 'text/plain')])
427427
attachment = mail.outbox[0].attachments[0]
428428
self.assertEqual(decode_b64_msg(attachment.get_payload()),
429-
TXT_FILE)
429+
TXT_FILE)
430430

431431
@patch.object(
432432
template_backend_klass, '_render_email',
@@ -439,7 +439,7 @@ def test_send_attachment_tripple(self, render_mock):
439439
attachments=[('black_pixel.png', TXT_FILE, 'text/plain')])
440440
attachment = mail.outbox[0].attachments[0]
441441
self.assertEqual(('black_pixel.png', TXT_FILE, 'text/plain'),
442-
attachment)
442+
attachment)
443443

444444
@patch.object(
445445
template_backend_klass, '_render_email',
@@ -453,7 +453,7 @@ def test_get_email_message_attachment_mime_base(self, mock):
453453
attachments=[MIMEImage(TXT_FILE, 'text/plain')])
454454
attachment = message.attachments[0]
455455
self.assertEqual(decode_b64_msg(attachment.get_payload()),
456-
TXT_FILE)
456+
TXT_FILE)
457457

458458
@patch.object(
459459
template_backend_klass, '_render_email',
@@ -467,7 +467,7 @@ def test_get_email_message_attachment_tripple(self, mock):
467467
attachments=[('black_pixel.png', TXT_FILE, 'text/plain')])
468468
attachment = message.attachments[0]
469469
self.assertEqual(('black_pixel.png', TXT_FILE, 'text/plain'),
470-
attachment)
470+
attachment)
471471

472472
def test_removal_of_legacy(self):
473473
try:

tests/generic_views/test_views.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_form_valid_with_send_on_success(self):
105105
self.assertEqual(Author.objects.count(), 1)
106106
self.assertEqual(len(mail.outbox), 1)
107107
self.assertEqual(mail.outbox[0].alternatives[0][0].strip(),
108-
'Andre - [email protected]')
108+
'Andre - [email protected]')
109109

110110
def test_form_valid_with_send_on_success_false(self):
111111
default_value = AuthorCreateView.templated_email_send_on_success
@@ -130,7 +130,7 @@ def test_form_invalid_with_send_on_failure(self):
130130
self.assertEqual(Author.objects.count(), 0)
131131
self.assertEqual(len(mail.outbox), 1)
132132
self.assertEqual(mail.outbox[0].alternatives[0][0].strip(),
133-
'* Enter a valid email address.')
133+
'* Enter a valid email address.')
134134
AuthorCreateView.templated_email_send_on_failure = default_value
135135

136136
@override_settings(TEMPLATED_EMAIL_FROM_EMAIL='[email protected]')

tests/test_urls.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from django.conf.urls import url, include
1+
from django.conf.urls import include
2+
from django.urls import re_path
23

34
urlpatterns = [
4-
url(r'^', include('templated_email.urls', namespace='templated_email')),
5+
re_path(r'^', include('templated_email.urls', namespace='templated_email')),
56
]

tests/test_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ def test_attach_to_message(self):
4949
self.inline_image.attach_to_message(message)
5050
mimeimage = message.attach.call_args[0][0]
5151
self.assertEqual(mimeimage.get('Content-ID'),
52-
self.inline_image._content_id)
52+
self.inline_image._content_id)
5353
self.assertEqual(mimeimage.get('Content-Disposition'),
54-
'inline; filename="foo.png"')
54+
'inline; filename="foo.png"')

tox-requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ mock
66
pytest
77
pytest-django
88
pytest-pythonpath
9-
six
109
tox

tox.ini

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
[tox]
22
envlist =
33
py36-{flake8},
4-
{py34,py35,py36,py37}-django{20}
5-
{py35,py36,py37}-django{21}
6-
{py35,py36,py37,py38}-django{22}
7-
{py36,py37,py38}-django{30}
4+
{py36,py37,py38,py39}-django{22,31,32}
85

96

107
[testenv]
@@ -13,12 +10,11 @@ commands=
1310
deps=
1411
-rtox-requirements.txt
1512
pytest-cov
16-
django20: Django==2.0
17-
django21: Django==2.1
1813
django22: Django==2.2
19-
django30: Django==3.0
14+
django31: Django==3.1
15+
django32: Django==3.2
2016

21-
[testenv:py27-flake8]
17+
[testenv:py36-flake8]
2218
commands = flake8 templated_email tests --ignore=E501
2319
deps =
2420
flake8

0 commit comments

Comments
 (0)