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
|
||||
dist/
|
||||
docs/_build/
|
||||
TODO.txt
|
||||
local.py
|
||||
|
||||
@@ -2,7 +2,7 @@ sudo: false
|
||||
language: python
|
||||
matrix:
|
||||
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 }
|
||||
# Django 1.5: Python 2.7, pypy
|
||||
- { 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
|
||||
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/)
|
||||
in the Djrill documentation for more information.
|
||||
Please see [Contributing](https://anymail.readthedocs.org/en/latest/contributing/)
|
||||
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.
|
||||
|
||||
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
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Brack3t nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
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
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
include README.rst AUTHORS.txt LICENSE
|
||||
recursive-include djrill *.py
|
||||
prune djrill/tests
|
||||
recursive-include anymail *.py
|
||||
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
|
||||
__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.message import sanitize_address, DEFAULT_ATTACHMENT_MIME_TYPE
|
||||
|
||||
from ..._version import __version__
|
||||
from ...exceptions import (DjrillError, MandrillAPIError, MandrillRecipientsRefused,
|
||||
from .._version import __version__
|
||||
from ..exceptions import (DjrillError, MandrillAPIError, MandrillRecipientsRefused,
|
||||
NotSerializableForMandrillError, NotSupportedByMandrillError)
|
||||
|
||||
|
||||
class DjrillBackend(BaseEmailBackend):
|
||||
class MandrillBackend(BaseEmailBackend):
|
||||
"""
|
||||
Mandrill API Email Backend
|
||||
"""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
"""Init options from Django settings"""
|
||||
super(DjrillBackend, self).__init__(**kwargs)
|
||||
super(MandrillBackend, self).__init__(**kwargs)
|
||||
|
||||
try:
|
||||
self.api_key = settings.MANDRILL_API_KEY
|
||||
@@ -223,7 +223,7 @@ class DjrillBackend(BaseEmailBackend):
|
||||
"""Validate parsed_response, raising exceptions for any problems.
|
||||
|
||||
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.
|
||||
|
||||
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",
|
||||
EMAIL_BACKEND="djrill.mail.backends.djrill.DjrillBackend")
|
||||
EMAIL_BACKEND="anymail.backends.mandrill.MandrillBackend")
|
||||
class DjrillBackendMockAPITestCase(TestCase):
|
||||
"""TestCase that uses Djrill EmailBackend with a mocked Mandrill API"""
|
||||
|
||||
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'):
|
||||
super(DjrillBackendMockAPITestCase.MockResponse, self).__init__()
|
||||
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.utils import override_settings
|
||||
|
||||
from djrill import MandrillAPIError, MandrillRecipientsRefused
|
||||
from anymail import MandrillAPIError, MandrillRecipientsRefused
|
||||
|
||||
|
||||
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,
|
||||
"Set MANDRILL_TEST_API_KEY environment variable to run integration tests")
|
||||
@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):
|
||||
"""Mandrill API integration tests
|
||||
|
||||
@@ -19,7 +19,7 @@ from django.core.mail import make_msgid
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from djrill import (MandrillAPIError, MandrillRecipientsRefused,
|
||||
from anymail import (MandrillAPIError, MandrillRecipientsRefused,
|
||||
NotSerializableForMandrillError, NotSupportedByMandrillError)
|
||||
|
||||
from .mock_backend import DjrillBackendMockAPITestCase
|
||||
@@ -742,7 +742,7 @@ class DjrillMandrillGlobalFeatureTests(DjrillBackendMockAPITestCase):
|
||||
[{'name': 'TEST', 'content': 'Hello'}])
|
||||
|
||||
|
||||
@override_settings(EMAIL_BACKEND="djrill.mail.backends.djrill.DjrillBackend")
|
||||
@override_settings(EMAIL_BACKEND="anymail.backends.mandrill.MandrillBackend")
|
||||
class DjrillImproperlyConfiguredTests(TestCase):
|
||||
"""Test Djrill backend without Djrill-specific settings in place"""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from django.core import mail
|
||||
|
||||
from djrill import MandrillAPIError
|
||||
from anymail import MandrillAPIError
|
||||
|
||||
from .mock_backend import DjrillBackendMockAPITestCase
|
||||
|
||||
@@ -8,8 +8,8 @@ from django.core.exceptions import ImproperlyConfigured
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from djrill.compat import b
|
||||
from djrill.signals import webhook_event
|
||||
from anymail.compat import b
|
||||
from anymail.signals import webhook_event
|
||||
|
||||
|
||||
class DjrillWebhookSecretMixinTests(TestCase):
|
||||
30
docs/conf.py
30
docs/conf.py
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Djrill documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sat Mar 2 13:07:34 2013.
|
||||
# Anymail documentation build configuration file, created by
|
||||
# sphinx-quickstart
|
||||
#
|
||||
# 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.
|
||||
sys.path.insert(0, os.path.abspath('..'))
|
||||
|
||||
# define __version__ and __minor_version__ from ../djrill/_version.py,
|
||||
# but without importing from djrill (which would make docs dependent on Django, etc.)
|
||||
with open("../djrill/_version.py") as f:
|
||||
code = compile(f.read(), "../djrill/_version.py", 'exec')
|
||||
# define __version__ and __minor_version__ from ../anymail/_version.py,
|
||||
# but without importing from anymail (which would make docs dependent on Django, etc.)
|
||||
with open("../anymail/_version.py") as f:
|
||||
code = compile(f.read(), "../anymail/_version.py", 'exec')
|
||||
exec(code)
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
@@ -46,9 +46,9 @@ source_suffix = '.rst'
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'Djrill'
|
||||
project = u'Anymail'
|
||||
# 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
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
@@ -171,7 +171,7 @@ html_static_path = ['_static']
|
||||
#html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'Djrilldoc'
|
||||
htmlhelp_basename = 'Anymaildoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output --------------------------------------------------
|
||||
@@ -190,8 +190,8 @@ latex_elements = {
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'Djrill.tex', u'Djrill Documentation',
|
||||
u'Djrill contributors (see AUTHORS.txt)', 'manual'),
|
||||
('index', 'Anymail.tex', u'Anymail Documentation',
|
||||
u'Anymail contributors (see AUTHORS.txt)', 'manual'),
|
||||
]
|
||||
|
||||
# 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
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'djrill', u'Djrill Documentation',
|
||||
[u'Djrill contributors (see AUTHORS.txt)'], 1)
|
||||
('index', 'anymail', u'Anymail Documentation',
|
||||
[u'Anymail contributors (see AUTHORS.txt)'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
@@ -234,8 +234,8 @@ man_pages = [
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'Djrill', u'Djrill Documentation',
|
||||
u'Djrill contributors (see AUTHORS.txt)', 'Djrill', 'Mandrill integration for Django.',
|
||||
('index', 'Anymail', u'Anymail Documentation',
|
||||
u'Anymail contributors (see AUTHORS.txt)', 'Anymail', 'Multi-ESP transactional email for Django.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import sys
|
||||
from django.conf import settings
|
||||
|
||||
APP = 'djrill'
|
||||
APP = 'anymail'
|
||||
|
||||
settings.configure(
|
||||
DEBUG=True,
|
||||
@@ -29,7 +29,7 @@ settings.configure(
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
),
|
||||
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.
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
|
||||
28
setup.py
28
setup.py
@@ -1,16 +1,18 @@
|
||||
from setuptools import setup
|
||||
import re
|
||||
|
||||
# define __version__ and __minor_version__ from djrill/_version.py,
|
||||
# but without importing from djrill (which would break setup)
|
||||
with open("djrill/_version.py") as f:
|
||||
code = compile(f.read(), "djrill/_version.py", 'exec')
|
||||
# define __version__ and __minor_version__ from anymail/_version.py,
|
||||
# but without importing from anymail (which would break setup)
|
||||
__version__ = "UNSET"
|
||||
__minor_version__ = "UNSET"
|
||||
with open("anymail/_version.py") as f:
|
||||
code = compile(f.read(), "anymail/_version.py", 'exec')
|
||||
exec(code)
|
||||
|
||||
|
||||
def long_description_from_readme(rst):
|
||||
# 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'/latest', '/v' + __minor_version__, rst) # ReadTheDocs
|
||||
return rst
|
||||
@@ -19,27 +21,27 @@ with open('README.rst') as f:
|
||||
long_description = long_description_from_readme(f.read())
|
||||
|
||||
setup(
|
||||
name="djrill",
|
||||
name="django-anymail",
|
||||
version=__version__,
|
||||
description='Mandrill transactional email for Django',
|
||||
keywords="django, mailchimp, mandrill, email, email backend",
|
||||
author="Kenneth Love <kenneth@brack3t.com>, Chris Jones <chris@brack3t.com>",
|
||||
author_email="kenneth@brack3t.com",
|
||||
url="https://github.com/brack3t/Djrill/",
|
||||
description='Multi-ESP transactional email for Django',
|
||||
keywords="django, email, email backend, mailgun, mandrill, postmark, sendgrid",
|
||||
author="Mike Edmunds <medmunds@gmail.com>",
|
||||
author_email="medmunds@gmail.com",
|
||||
url="https://github.com/anymail/anymail/",
|
||||
license="BSD License",
|
||||
packages=["djrill"],
|
||||
packages=["anymail"],
|
||||
zip_safe=False,
|
||||
install_requires=["requests>=1.0.0", "django>=1.4"],
|
||||
include_package_data=True,
|
||||
test_suite="runtests.runtests",
|
||||
tests_require=["mock", "six"],
|
||||
classifiers=[
|
||||
"Development Status :: 2 - Pre-Alpha",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: Implementation :: PyPy",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
|
||||
Reference in New Issue
Block a user