mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Fork from Djrill and rename to "anymail"
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,5 +5,4 @@
|
|||||||
*.egg-info
|
*.egg-info
|
||||||
dist/
|
dist/
|
||||||
docs/_build/
|
docs/_build/
|
||||||
TODO.txt
|
|
||||||
local.py
|
local.py
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ sudo: false
|
|||||||
language: python
|
language: python
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
# Django 1.4: Python 2.6--2.7 (but Djrill doesn't support 2.6)
|
# Django 1.4: Python 2.6--2.7 (but Anymail doesn't support 2.6)
|
||||||
- { env: DJANGO=django==1.4, python: 2.7 }
|
- { env: DJANGO=django==1.4, python: 2.7 }
|
||||||
# Django 1.5: Python 2.7, pypy
|
# Django 1.5: Python 2.7, pypy
|
||||||
- { env: DJANGO=django==1.5, python: 2.7 }
|
- { env: DJANGO=django==1.5, python: 2.7 }
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
Django-Djrill
|
Anymail
|
||||||
=============
|
=======
|
||||||
|
|
||||||
|
Mike Edmunds
|
||||||
|
|
||||||
|
|
||||||
|
Anymail was forked from Djrill, which included contributions from:
|
||||||
|
|
||||||
Kenneth Love
|
Kenneth Love
|
||||||
Chris Jones
|
Chris Jones
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Djrill is maintained by its users. Your contributions are encouraged!
|
Anymail is maintained by its users. Your contributions are encouraged!
|
||||||
|
|
||||||
Please see [Contributing](https://djrill.readthedocs.org/en/latest/contributing/)
|
Please see [Contributing](https://anymail.readthedocs.org/en/latest/contributing/)
|
||||||
in the Djrill documentation for more information.
|
in the Anymail documentation for more information.
|
||||||
|
|||||||
10
LICENSE
10
LICENSE
@@ -1,4 +1,6 @@
|
|||||||
Copyright (c) Brack3t and individual contributors.
|
[The BSD 3-Clause License]
|
||||||
|
|
||||||
|
Copyright (c) Anymail Contributors.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
@@ -11,9 +13,9 @@ are permitted provided that the following conditions are met:
|
|||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
3. Neither the name of Brack3t nor the names of its contributors may be used
|
3. Neither the name of the copyright holder nor the names of its contributors
|
||||||
to endorse or promote products derived from this software without
|
may be used to endorse or promote products derived from this software
|
||||||
specific prior written permission.
|
without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
include README.rst AUTHORS.txt LICENSE
|
include README.rst AUTHORS.txt LICENSE
|
||||||
recursive-include djrill *.py
|
recursive-include anymail *.py
|
||||||
prune djrill/tests
|
prune anymail/tests
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
VERSION = (2, 1, 'dev0') # Remove the 'dev' component in release branches
|
VERSION = (0, 1, 'dev0') # Remove the 'dev' component in release branches
|
||||||
__version__ = '.'.join([str(x) for x in VERSION]) # major.minor.patch or major.minor.devN
|
__version__ = '.'.join([str(x) for x in VERSION]) # major.minor.patch or major.minor.devN
|
||||||
__minor_version__ = '.'.join([str(x) for x in VERSION[:2]]) # Sphinx's X.Y "version"
|
__minor_version__ = '.'.join([str(x) for x in VERSION[:2]]) # Sphinx's X.Y "version"
|
||||||
@@ -15,19 +15,19 @@ from django.core.exceptions import ImproperlyConfigured
|
|||||||
from django.core.mail.backends.base import BaseEmailBackend
|
from django.core.mail.backends.base import BaseEmailBackend
|
||||||
from django.core.mail.message import sanitize_address, DEFAULT_ATTACHMENT_MIME_TYPE
|
from django.core.mail.message import sanitize_address, DEFAULT_ATTACHMENT_MIME_TYPE
|
||||||
|
|
||||||
from ..._version import __version__
|
from .._version import __version__
|
||||||
from ...exceptions import (DjrillError, MandrillAPIError, MandrillRecipientsRefused,
|
from ..exceptions import (DjrillError, MandrillAPIError, MandrillRecipientsRefused,
|
||||||
NotSerializableForMandrillError, NotSupportedByMandrillError)
|
NotSerializableForMandrillError, NotSupportedByMandrillError)
|
||||||
|
|
||||||
|
|
||||||
class DjrillBackend(BaseEmailBackend):
|
class MandrillBackend(BaseEmailBackend):
|
||||||
"""
|
"""
|
||||||
Mandrill API Email Backend
|
Mandrill API Email Backend
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
"""Init options from Django settings"""
|
"""Init options from Django settings"""
|
||||||
super(DjrillBackend, self).__init__(**kwargs)
|
super(MandrillBackend, self).__init__(**kwargs)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.api_key = settings.MANDRILL_API_KEY
|
self.api_key = settings.MANDRILL_API_KEY
|
||||||
@@ -223,7 +223,7 @@ class DjrillBackend(BaseEmailBackend):
|
|||||||
"""Validate parsed_response, raising exceptions for any problems.
|
"""Validate parsed_response, raising exceptions for any problems.
|
||||||
|
|
||||||
Extend this to provide your own validation checks.
|
Extend this to provide your own validation checks.
|
||||||
Validation exceptions should inherit from djrill.exceptions.DjrillException
|
Validation exceptions should inherit from anymail.exceptions.DjrillException
|
||||||
for proper fail_silently behavior.
|
for proper fail_silently behavior.
|
||||||
|
|
||||||
The base version here checks for invalid or refused recipients.
|
The base version here checks for invalid or refused recipients.
|
||||||
@@ -16,12 +16,12 @@ MANDRILL_SUCCESS_RESPONSE = b"""[{
|
|||||||
|
|
||||||
|
|
||||||
@override_settings(MANDRILL_API_KEY="FAKE_API_KEY_FOR_TESTING",
|
@override_settings(MANDRILL_API_KEY="FAKE_API_KEY_FOR_TESTING",
|
||||||
EMAIL_BACKEND="djrill.mail.backends.djrill.DjrillBackend")
|
EMAIL_BACKEND="anymail.backends.mandrill.MandrillBackend")
|
||||||
class DjrillBackendMockAPITestCase(TestCase):
|
class DjrillBackendMockAPITestCase(TestCase):
|
||||||
"""TestCase that uses Djrill EmailBackend with a mocked Mandrill API"""
|
"""TestCase that uses Djrill EmailBackend with a mocked Mandrill API"""
|
||||||
|
|
||||||
class MockResponse(requests.Response):
|
class MockResponse(requests.Response):
|
||||||
"""requests.post return value mock sufficient for DjrillBackend"""
|
"""requests.post return value mock sufficient for MandrillBackend"""
|
||||||
def __init__(self, status_code=200, raw=MANDRILL_SUCCESS_RESPONSE, encoding='utf-8'):
|
def __init__(self, status_code=200, raw=MANDRILL_SUCCESS_RESPONSE, encoding='utf-8'):
|
||||||
super(DjrillBackendMockAPITestCase.MockResponse, self).__init__()
|
super(DjrillBackendMockAPITestCase.MockResponse, self).__init__()
|
||||||
self.status_code = status_code
|
self.status_code = status_code
|
||||||
|
Before Width: | Height: | Size: 579 B After Width: | Height: | Size: 579 B |
@@ -7,7 +7,7 @@ from django.core import mail
|
|||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
|
|
||||||
from djrill import MandrillAPIError, MandrillRecipientsRefused
|
from anymail import MandrillAPIError, MandrillRecipientsRefused
|
||||||
|
|
||||||
|
|
||||||
MANDRILL_TEST_API_KEY = os.getenv('MANDRILL_TEST_API_KEY')
|
MANDRILL_TEST_API_KEY = os.getenv('MANDRILL_TEST_API_KEY')
|
||||||
@@ -16,7 +16,7 @@ MANDRILL_TEST_API_KEY = os.getenv('MANDRILL_TEST_API_KEY')
|
|||||||
@unittest.skipUnless(MANDRILL_TEST_API_KEY,
|
@unittest.skipUnless(MANDRILL_TEST_API_KEY,
|
||||||
"Set MANDRILL_TEST_API_KEY environment variable to run integration tests")
|
"Set MANDRILL_TEST_API_KEY environment variable to run integration tests")
|
||||||
@override_settings(MANDRILL_API_KEY=MANDRILL_TEST_API_KEY,
|
@override_settings(MANDRILL_API_KEY=MANDRILL_TEST_API_KEY,
|
||||||
EMAIL_BACKEND="djrill.mail.backends.djrill.DjrillBackend")
|
EMAIL_BACKEND="anymail.backends.mandrill.MandrillBackend")
|
||||||
class DjrillIntegrationTests(TestCase):
|
class DjrillIntegrationTests(TestCase):
|
||||||
"""Mandrill API integration tests
|
"""Mandrill API integration tests
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ from django.core.mail import make_msgid
|
|||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
|
|
||||||
from djrill import (MandrillAPIError, MandrillRecipientsRefused,
|
from anymail import (MandrillAPIError, MandrillRecipientsRefused,
|
||||||
NotSerializableForMandrillError, NotSupportedByMandrillError)
|
NotSerializableForMandrillError, NotSupportedByMandrillError)
|
||||||
|
|
||||||
from .mock_backend import DjrillBackendMockAPITestCase
|
from .mock_backend import DjrillBackendMockAPITestCase
|
||||||
@@ -742,7 +742,7 @@ class DjrillMandrillGlobalFeatureTests(DjrillBackendMockAPITestCase):
|
|||||||
[{'name': 'TEST', 'content': 'Hello'}])
|
[{'name': 'TEST', 'content': 'Hello'}])
|
||||||
|
|
||||||
|
|
||||||
@override_settings(EMAIL_BACKEND="djrill.mail.backends.djrill.DjrillBackend")
|
@override_settings(EMAIL_BACKEND="anymail.backends.mandrill.MandrillBackend")
|
||||||
class DjrillImproperlyConfiguredTests(TestCase):
|
class DjrillImproperlyConfiguredTests(TestCase):
|
||||||
"""Test Djrill backend without Djrill-specific settings in place"""
|
"""Test Djrill backend without Djrill-specific settings in place"""
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
from django.core import mail
|
from django.core import mail
|
||||||
|
|
||||||
from djrill import MandrillAPIError
|
from anymail import MandrillAPIError
|
||||||
|
|
||||||
from .mock_backend import DjrillBackendMockAPITestCase
|
from .mock_backend import DjrillBackendMockAPITestCase
|
||||||
|
|
||||||
@@ -8,8 +8,8 @@ from django.core.exceptions import ImproperlyConfigured
|
|||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
|
|
||||||
from djrill.compat import b
|
from anymail.compat import b
|
||||||
from djrill.signals import webhook_event
|
from anymail.signals import webhook_event
|
||||||
|
|
||||||
|
|
||||||
class DjrillWebhookSecretMixinTests(TestCase):
|
class DjrillWebhookSecretMixinTests(TestCase):
|
||||||
30
docs/conf.py
30
docs/conf.py
@@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Djrill documentation build configuration file, created by
|
# Anymail documentation build configuration file, created by
|
||||||
# sphinx-quickstart on Sat Mar 2 13:07:34 2013.
|
# sphinx-quickstart
|
||||||
#
|
#
|
||||||
# This file is execfile()d with the current directory set to its containing dir.
|
# This file is execfile()d with the current directory set to its containing dir.
|
||||||
#
|
#
|
||||||
@@ -18,10 +18,10 @@ import sys, os
|
|||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
sys.path.insert(0, os.path.abspath('..'))
|
sys.path.insert(0, os.path.abspath('..'))
|
||||||
|
|
||||||
# define __version__ and __minor_version__ from ../djrill/_version.py,
|
# define __version__ and __minor_version__ from ../anymail/_version.py,
|
||||||
# but without importing from djrill (which would make docs dependent on Django, etc.)
|
# but without importing from anymail (which would make docs dependent on Django, etc.)
|
||||||
with open("../djrill/_version.py") as f:
|
with open("../anymail/_version.py") as f:
|
||||||
code = compile(f.read(), "../djrill/_version.py", 'exec')
|
code = compile(f.read(), "../anymail/_version.py", 'exec')
|
||||||
exec(code)
|
exec(code)
|
||||||
|
|
||||||
# -- General configuration -----------------------------------------------------
|
# -- General configuration -----------------------------------------------------
|
||||||
@@ -46,9 +46,9 @@ source_suffix = '.rst'
|
|||||||
master_doc = 'index'
|
master_doc = 'index'
|
||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = u'Djrill'
|
project = u'Anymail'
|
||||||
# noinspection PyShadowingBuiltins
|
# noinspection PyShadowingBuiltins
|
||||||
copyright = u'2015, Djrill contributors (see AUTHORS.txt)'
|
copyright = u'2016, Anymail contributors (see AUTHORS.txt)'
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
@@ -171,7 +171,7 @@ html_static_path = ['_static']
|
|||||||
#html_file_suffix = None
|
#html_file_suffix = None
|
||||||
|
|
||||||
# Output file base name for HTML help builder.
|
# Output file base name for HTML help builder.
|
||||||
htmlhelp_basename = 'Djrilldoc'
|
htmlhelp_basename = 'Anymaildoc'
|
||||||
|
|
||||||
|
|
||||||
# -- Options for LaTeX output --------------------------------------------------
|
# -- Options for LaTeX output --------------------------------------------------
|
||||||
@@ -190,8 +190,8 @@ latex_elements = {
|
|||||||
# Grouping the document tree into LaTeX files. List of tuples
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
('index', 'Djrill.tex', u'Djrill Documentation',
|
('index', 'Anymail.tex', u'Anymail Documentation',
|
||||||
u'Djrill contributors (see AUTHORS.txt)', 'manual'),
|
u'Anymail contributors (see AUTHORS.txt)', 'manual'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
@@ -220,8 +220,8 @@ latex_documents = [
|
|||||||
# One entry per manual page. List of tuples
|
# One entry per manual page. List of tuples
|
||||||
# (source start file, name, description, authors, manual section).
|
# (source start file, name, description, authors, manual section).
|
||||||
man_pages = [
|
man_pages = [
|
||||||
('index', 'djrill', u'Djrill Documentation',
|
('index', 'anymail', u'Anymail Documentation',
|
||||||
[u'Djrill contributors (see AUTHORS.txt)'], 1)
|
[u'Anymail contributors (see AUTHORS.txt)'], 1)
|
||||||
]
|
]
|
||||||
|
|
||||||
# If true, show URL addresses after external links.
|
# If true, show URL addresses after external links.
|
||||||
@@ -234,8 +234,8 @@ man_pages = [
|
|||||||
# (source start file, target name, title, author,
|
# (source start file, target name, title, author,
|
||||||
# dir menu entry, description, category)
|
# dir menu entry, description, category)
|
||||||
texinfo_documents = [
|
texinfo_documents = [
|
||||||
('index', 'Djrill', u'Djrill Documentation',
|
('index', 'Anymail', u'Anymail Documentation',
|
||||||
u'Djrill contributors (see AUTHORS.txt)', 'Djrill', 'Mandrill integration for Django.',
|
u'Anymail contributors (see AUTHORS.txt)', 'Anymail', 'Multi-ESP transactional email for Django.',
|
||||||
'Miscellaneous'),
|
'Miscellaneous'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import sys
|
import sys
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
APP = 'djrill'
|
APP = 'anymail'
|
||||||
|
|
||||||
settings.configure(
|
settings.configure(
|
||||||
DEBUG=True,
|
DEBUG=True,
|
||||||
@@ -29,7 +29,7 @@ settings.configure(
|
|||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
),
|
),
|
||||||
TEMPLATES=[
|
TEMPLATES=[
|
||||||
# Djrill doesn't have any templates, but tests need a TEMPLATES
|
# Anymail doesn't have any templates, but tests need a TEMPLATES
|
||||||
# setting to avoid warnings from the Django 1.8+ test client.
|
# setting to avoid warnings from the Django 1.8+ test client.
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
|||||||
28
setup.py
28
setup.py
@@ -1,16 +1,18 @@
|
|||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# define __version__ and __minor_version__ from djrill/_version.py,
|
# define __version__ and __minor_version__ from anymail/_version.py,
|
||||||
# but without importing from djrill (which would break setup)
|
# but without importing from anymail (which would break setup)
|
||||||
with open("djrill/_version.py") as f:
|
__version__ = "UNSET"
|
||||||
code = compile(f.read(), "djrill/_version.py", 'exec')
|
__minor_version__ = "UNSET"
|
||||||
|
with open("anymail/_version.py") as f:
|
||||||
|
code = compile(f.read(), "anymail/_version.py", 'exec')
|
||||||
exec(code)
|
exec(code)
|
||||||
|
|
||||||
|
|
||||||
def long_description_from_readme(rst):
|
def long_description_from_readme(rst):
|
||||||
# In release branches, freeze some external links to refer to this X.Y version:
|
# In release branches, freeze some external links to refer to this X.Y version:
|
||||||
if not "dev" in __version__:
|
if "dev" not in __version__:
|
||||||
rst = re.sub(r'branch=master', 'branch=v' + __minor_version__, rst) # Travis build status
|
rst = re.sub(r'branch=master', 'branch=v' + __minor_version__, rst) # Travis build status
|
||||||
rst = re.sub(r'/latest', '/v' + __minor_version__, rst) # ReadTheDocs
|
rst = re.sub(r'/latest', '/v' + __minor_version__, rst) # ReadTheDocs
|
||||||
return rst
|
return rst
|
||||||
@@ -19,27 +21,27 @@ with open('README.rst') as f:
|
|||||||
long_description = long_description_from_readme(f.read())
|
long_description = long_description_from_readme(f.read())
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="djrill",
|
name="django-anymail",
|
||||||
version=__version__,
|
version=__version__,
|
||||||
description='Mandrill transactional email for Django',
|
description='Multi-ESP transactional email for Django',
|
||||||
keywords="django, mailchimp, mandrill, email, email backend",
|
keywords="django, email, email backend, mailgun, mandrill, postmark, sendgrid",
|
||||||
author="Kenneth Love <kenneth@brack3t.com>, Chris Jones <chris@brack3t.com>",
|
author="Mike Edmunds <medmunds@gmail.com>",
|
||||||
author_email="kenneth@brack3t.com",
|
author_email="medmunds@gmail.com",
|
||||||
url="https://github.com/brack3t/Djrill/",
|
url="https://github.com/anymail/anymail/",
|
||||||
license="BSD License",
|
license="BSD License",
|
||||||
packages=["djrill"],
|
packages=["anymail"],
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
install_requires=["requests>=1.0.0", "django>=1.4"],
|
install_requires=["requests>=1.0.0", "django>=1.4"],
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
test_suite="runtests.runtests",
|
test_suite="runtests.runtests",
|
||||||
tests_require=["mock", "six"],
|
tests_require=["mock", "six"],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
"Development Status :: 2 - Pre-Alpha",
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Programming Language :: Python :: Implementation :: PyPy",
|
"Programming Language :: Python :: Implementation :: PyPy",
|
||||||
"Programming Language :: Python :: Implementation :: CPython",
|
"Programming Language :: Python :: Implementation :: CPython",
|
||||||
"Programming Language :: Python :: 2.7",
|
"Programming Language :: Python :: 2.7",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.3",
|
|
||||||
"Programming Language :: Python :: 3.4",
|
"Programming Language :: Python :: 3.4",
|
||||||
"Programming Language :: Python :: 3.5",
|
"Programming Language :: Python :: 3.5",
|
||||||
"License :: OSI Approved :: BSD License",
|
"License :: OSI Approved :: BSD License",
|
||||||
|
|||||||
Reference in New Issue
Block a user