[Python-modules-commits] [django-anymail] 01/04: Imported Upstream version 1.0
Scott Kitterman
kitterman at moszumanska.debian.org
Sat Oct 7 23:00:10 UTC 2017
This is an automated email from the git hooks/post-receive script.
kitterman pushed a commit to branch debian/master
in repository django-anymail.
commit ef100a2a8636edcf1fda8a6d21264db544dc6352
Author: Scott Kitterman <scott at kitterman.com>
Date: Sat Oct 7 18:46:50 2017 -0400
Imported Upstream version 1.0
---
PKG-INFO | 28 ++++++++--------------
README.rst | 10 +-------
anymail/_version.py | 2 +-
anymail/backends/mailgun.py | 12 +---------
anymail/backends/mandrill.py | 11 +--------
anymail/backends/postmark.py | 12 +---------
anymail/backends/sendgrid.py | 17 ++++---------
anymail/backends/sendgrid_v2.py | 4 ++--
anymail/backends/sparkpost.py | 14 +----------
anymail/backends/test.py | 52 ++++++++++++++++++++++++----------------
anymail/utils.py | 4 ++++
django_anymail.egg-info/PKG-INFO | 28 ++++++++--------------
setup.py | 2 +-
13 files changed, 68 insertions(+), 128 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index dcf8bd6..6da7311 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: django-anymail
-Version: 0.11.1
+Version: 1.0
Summary: Django email backends for Mailgun, Mailjet, Postmark, SendGrid, SparkPost and other transactional ESPs
Home-page: https://github.com/anymail/django-anymail
Author: Mike Edmunds <medmunds at gmail.com>
@@ -9,15 +9,6 @@ License: BSD License
Description: Anymail: Django email backends for Mailgun, Mailjet, Postmark, SendGrid, SparkPost and more
===========================================================================================
- **PRE-1.0**
-
- Although several projects are using this package in production,
- the API and feature set are still evolving, and the package has
- not yet reached 1.0 status. Before 1.0, minor version bumps might
- include breaking changes (following semantic versioning rules).
- Please check the
- `release notes <https://github.com/anymail/django-anymail/releases>`_
-
.. This README is reused in multiple places:
* Github: project page, exactly as it appears here
* Docs: shared-intro section gets included in docs/index.rst
@@ -47,7 +38,7 @@ Description: Anymail: Django email backends for Mailgun, Mailjet, Postmark, Send
built-in `django.core.mail` package. It includes:
* Support for HTML, attachments, extra headers, and other features of
- `Django's built-in email <https://docs.djangoproject.com/en/v0.11.1/topics/email/>`_
+ `Django's built-in email <https://docs.djangoproject.com/en/v1.0/topics/email/>`_
* Extensions that make it easy to use extra ESP functionality, like tags, metadata,
and tracking, with code that's portable between ESPs
* Simplified inline images for HTML email
@@ -61,19 +52,20 @@ Description: Anymail: Django email backends for Mailgun, Mailjet, Postmark, Send
.. END shared-intro
- .. image:: https://travis-ci.org/anymail/django-anymail.svg?branch=v0.11.1
+ .. image:: https://travis-ci.org/anymail/django-anymail.svg?branch=v1.0
:target: https://travis-ci.org/anymail/django-anymail
:alt: build status on Travis-CI
- .. image:: https://readthedocs.org/projects/anymail/badge/?version=v0.11.1
- :target: https://anymail.readthedocs.io/en/v0.11.1/
+ .. image:: https://readthedocs.org/projects/anymail/badge/?version=v1.0
+ :target: https://anymail.readthedocs.io/en/v1.0/
:alt: documentation on ReadTheDocs
**Resources**
- * Full documentation: https://anymail.readthedocs.io/en/v0.11.1/
+ * Full documentation: https://anymail.readthedocs.io/en/v1.0/
* Package on PyPI: https://pypi.python.org/pypi/django-anymail
* Project on Github: https://github.com/anymail/django-anymail
+ * Changelog: https://github.com/anymail/django-anymail/releases
Anymail 1-2-3
@@ -115,7 +107,7 @@ Description: Anymail: Django email backends for Mailgun, Mailjet, Postmark, Send
DEFAULT_FROM_EMAIL = "you at example.com" # if you don't already have this in settings
- 3. Now the regular `Django email functions <https://docs.djangoproject.com/en/v0.11.1/topics/email/>`_
+ 3. Now the regular `Django email functions <https://docs.djangoproject.com/en/v1.0/topics/email/>`_
will send through your chosen ESP:
.. code-block:: python
@@ -159,12 +151,12 @@ Description: Anymail: Django email backends for Mailgun, Mailjet, Postmark, Send
.. END quickstart
- See the `full documentation <https://anymail.readthedocs.io/en/v0.11.1/>`_
+ See the `full documentation <https://anymail.readthedocs.io/en/v1.0/>`_
for more features and options.
Keywords: django,email,email backend,ESP,transactional mail,mailgun,mailjet,mandrill,postmark,sendgrid
Platform: UNKNOWN
-Classifier: Development Status :: 2 - Pre-Alpha
+Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: Implementation :: CPython
diff --git a/README.rst b/README.rst
index 59f0808..06366e4 100644
--- a/README.rst
+++ b/README.rst
@@ -1,15 +1,6 @@
Anymail: Django email backends for Mailgun, Mailjet, Postmark, SendGrid, SparkPost and more
===========================================================================================
- **PRE-1.0**
-
- Although several projects are using this package in production,
- the API and feature set are still evolving, and the package has
- not yet reached 1.0 status. Before 1.0, minor version bumps might
- include breaking changes (following semantic versioning rules).
- Please check the
- `release notes <https://github.com/anymail/django-anymail/releases>`_
-
.. This README is reused in multiple places:
* Github: project page, exactly as it appears here
* Docs: shared-intro section gets included in docs/index.rst
@@ -66,6 +57,7 @@ Anymail releases follow `semantic versioning <http://semver.org/>`_.
* Full documentation: https://anymail.readthedocs.io/en/stable/
* Package on PyPI: https://pypi.python.org/pypi/django-anymail
* Project on Github: https://github.com/anymail/django-anymail
+* Changelog: https://github.com/anymail/django-anymail/releases
Anymail 1-2-3
diff --git a/anymail/_version.py b/anymail/_version.py
index d8b8c35..f10356b 100644
--- a/anymail/_version.py
+++ b/anymail/_version.py
@@ -1,3 +1,3 @@
-VERSION = (0, 11, 1)
+VERSION = (1, 0)
__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"
diff --git a/anymail/backends/mailgun.py b/anymail/backends/mailgun.py
index 5f8d933..6ba75da 100644
--- a/anymail/backends/mailgun.py
+++ b/anymail/backends/mailgun.py
@@ -1,7 +1,6 @@
-import warnings
from datetime import datetime
-from ..exceptions import AnymailRequestsAPIError, AnymailError, AnymailDeprecationWarning
+from ..exceptions import AnymailRequestsAPIError, AnymailError
from ..message import AnymailRecipientStatus
from ..utils import get_anymail_setting, rfc2822date
@@ -57,15 +56,6 @@ class EmailBackend(AnymailRequestsBackend):
return {recipient.email: status for recipient in payload.all_recipients}
-# Pre-v0.8 naming (deprecated)
-class MailgunBackend(EmailBackend):
- def __init__(self, **kwargs):
- warnings.warn(AnymailDeprecationWarning(
- "Please update your EMAIL_BACKEND setting to "
- "'anymail.backends.mailgun.EmailBackend'"))
- super(MailgunBackend, self).__init__(**kwargs)
-
-
class MailgunPayload(RequestsPayload):
def __init__(self, message, defaults, backend, *args, **kwargs):
diff --git a/anymail/backends/mandrill.py b/anymail/backends/mandrill.py
index d45bc7d..758e7c4 100644
--- a/anymail/backends/mandrill.py
+++ b/anymail/backends/mandrill.py
@@ -1,7 +1,7 @@
import warnings
from datetime import datetime
-from ..exceptions import AnymailRequestsAPIError, AnymailWarning, AnymailDeprecationWarning
+from ..exceptions import AnymailRequestsAPIError, AnymailWarning
from ..message import AnymailRecipientStatus, ANYMAIL_STATUSES
from ..utils import last, combine, get_anymail_setting
@@ -47,15 +47,6 @@ class EmailBackend(AnymailRequestsBackend):
return recipient_status
-# Pre-v0.8 naming (deprecated)
-class MandrillBackend(EmailBackend):
- def __init__(self, **kwargs):
- warnings.warn(AnymailDeprecationWarning(
- "Please update your EMAIL_BACKEND setting to "
- "'anymail.backends.mandrill.EmailBackend'"))
- super(MandrillBackend, self).__init__(**kwargs)
-
-
class DjrillDeprecationWarning(AnymailWarning, DeprecationWarning):
"""Warning for features carried over from Djrill that will be removed soon"""
diff --git a/anymail/backends/postmark.py b/anymail/backends/postmark.py
index 22b9795..a144e9a 100644
--- a/anymail/backends/postmark.py
+++ b/anymail/backends/postmark.py
@@ -1,9 +1,8 @@
import re
-import warnings
from requests.structures import CaseInsensitiveDict
-from ..exceptions import AnymailRequestsAPIError, AnymailDeprecationWarning
+from ..exceptions import AnymailRequestsAPIError
from ..message import AnymailRecipientStatus
from ..utils import get_anymail_setting
@@ -95,15 +94,6 @@ class EmailBackend(AnymailRequestsBackend):
return []
-# Pre-v0.8 naming (deprecated)
-class PostmarkBackend(EmailBackend):
- def __init__(self, **kwargs):
- warnings.warn(AnymailDeprecationWarning(
- "Please update your EMAIL_BACKEND setting to "
- "'anymail.backends.postmark.EmailBackend'"))
- super(PostmarkBackend, self).__init__(**kwargs)
-
-
class PostmarkPayload(RequestsPayload):
def __init__(self, message, defaults, backend, *args, **kwargs):
diff --git a/anymail/backends/sendgrid.py b/anymail/backends/sendgrid.py
index afe6a16..1e702d5 100644
--- a/anymail/backends/sendgrid.py
+++ b/anymail/backends/sendgrid.py
@@ -5,9 +5,9 @@ from django.core.mail import make_msgid
from requests.structures import CaseInsensitiveDict
from .base_requests import AnymailRequestsBackend, RequestsPayload
-from ..exceptions import AnymailConfigurationError, AnymailRequestsAPIError, AnymailWarning, AnymailDeprecationWarning
+from ..exceptions import AnymailConfigurationError, AnymailRequestsAPIError, AnymailWarning
from ..message import AnymailRecipientStatus
-from ..utils import get_anymail_setting, timestamp, update_deep, parse_address_list
+from ..utils import BASIC_NUMERIC_TYPES, get_anymail_setting, timestamp, update_deep, parse_address_list
class EmailBackend(AnymailRequestsBackend):
@@ -67,15 +67,6 @@ class EmailBackend(AnymailRequestsBackend):
return {recipient.email: status for recipient in payload.all_recipients}
-# Pre-v0.8 naming (deprecated)
-class SendGridBackend(EmailBackend):
- def __init__(self, **kwargs):
- warnings.warn(AnymailDeprecationWarning(
- "Please update your EMAIL_BACKEND setting to "
- "'anymail.backends.sendgrid.EmailBackend'"))
- super(SendGridBackend, self).__init__(**kwargs)
-
-
class SendGridPayload(RequestsPayload):
def __init__(self, message, defaults, backend, *args, **kwargs):
@@ -249,7 +240,7 @@ class SendGridPayload(RequestsPayload):
# SendGrid requires header values to be strings -- not integers.
# We'll stringify ints and floats; anything else is the caller's responsibility.
self.data["headers"].update({
- k: str(v) if isinstance(v, (int, float)) else v
+ k: str(v) if isinstance(v, BASIC_NUMERIC_TYPES) else v
for k, v in headers.items()
})
@@ -299,7 +290,7 @@ class SendGridPayload(RequestsPayload):
# if they're not.)
# We'll stringify ints and floats; anything else is the caller's responsibility.
self.data["custom_args"] = {
- k: str(v) if isinstance(v, (int, float)) else v
+ k: str(v) if isinstance(v, BASIC_NUMERIC_TYPES) else v
for k, v in metadata.items()
}
diff --git a/anymail/backends/sendgrid_v2.py b/anymail/backends/sendgrid_v2.py
index c045a6f..889b763 100644
--- a/anymail/backends/sendgrid_v2.py
+++ b/anymail/backends/sendgrid_v2.py
@@ -5,7 +5,7 @@ from requests.structures import CaseInsensitiveDict
from ..exceptions import AnymailConfigurationError, AnymailRequestsAPIError, AnymailWarning
from ..message import AnymailRecipientStatus
-from ..utils import get_anymail_setting, timestamp
+from ..utils import BASIC_NUMERIC_TYPES, get_anymail_setting, timestamp
from .base_requests import AnymailRequestsBackend, RequestsPayload
@@ -238,7 +238,7 @@ class SendGridPayload(RequestsPayload):
# We'll stringify ints and floats; anything else is the caller's responsibility.
# (This field gets converted to json in self.serialize_data)
self.data["headers"].update({
- k: str(v) if isinstance(v, (int, float)) else v
+ k: str(v) if isinstance(v, BASIC_NUMERIC_TYPES) else v
for k, v in headers.items()
})
diff --git a/anymail/backends/sparkpost.py b/anymail/backends/sparkpost.py
index b3976b7..20e652e 100644
--- a/anymail/backends/sparkpost.py
+++ b/anymail/backends/sparkpost.py
@@ -1,10 +1,7 @@
from __future__ import absolute_import # we want the sparkpost package, not our own module
-import warnings
-
from .base import AnymailBaseBackend, BasePayload
-from ..exceptions import (AnymailAPIError, AnymailImproperlyInstalled,
- AnymailConfigurationError, AnymailDeprecationWarning)
+from ..exceptions import AnymailAPIError, AnymailImproperlyInstalled, AnymailConfigurationError
from ..message import AnymailRecipientStatus
from ..utils import get_anymail_setting
@@ -82,15 +79,6 @@ class EmailBackend(AnymailBaseBackend):
return {recipient.email: recipient_status for recipient in payload.all_recipients}
-# Pre-v0.8 naming (deprecated)
-class SparkPostBackend(EmailBackend):
- def __init__(self, **kwargs):
- warnings.warn(AnymailDeprecationWarning(
- "Please update your EMAIL_BACKEND setting to "
- "'anymail.backends.sparkpost.EmailBackend'"))
- super(SparkPostBackend, self).__init__(**kwargs)
-
-
class SparkPostPayload(BasePayload):
def init_payload(self):
self.params = {}
diff --git a/anymail/backends/test.py b/anymail/backends/test.py
index 0c3cbac..cc7c407 100644
--- a/anymail/backends/test.py
+++ b/anymail/backends/test.py
@@ -1,37 +1,42 @@
-from anymail.exceptions import AnymailAPIError
-from anymail.message import AnymailRecipientStatus
+from django.core import mail
from .base import AnymailBaseBackend, BasePayload
+from ..exceptions import AnymailAPIError
+from ..message import AnymailRecipientStatus
from ..utils import get_anymail_setting
class EmailBackend(AnymailBaseBackend):
"""
- Anymail backend that doesn't do anything.
+ Anymail backend that simulates sending messages, useful for testing.
- Used for testing Anymail common backend functionality.
+ Sent messages are collected in django.core.mail.outbox (as with Django's locmem backend).
+
+ In addition:
+ * Anymail send params parsed from the message will be attached to the outbox message
+ as a dict in the attr `anymail_test_params`
+ * If the caller supplies an `anymail_test_response` attr on the message, that will be
+ used instead of the default "sent" response. It can be either an AnymailRecipientStatus
+ or an instance of AnymailAPIError (or a subclass) to raise an exception.
"""
esp_name = "Test"
def __init__(self, *args, **kwargs):
- # Init options from Django settings
- esp_name = self.esp_name
- self.sample_setting = get_anymail_setting('sample_setting', esp_name=esp_name,
- kwargs=kwargs, allow_bare=True)
- self.recorded_send_params = get_anymail_setting('recorded_send_params', default=[],
- esp_name=esp_name, kwargs=kwargs)
super(EmailBackend, self).__init__(*args, **kwargs)
+ if not hasattr(mail, 'outbox'):
+ mail.outbox = [] # see django.core.mail.backends.locmem
def build_message_payload(self, message, defaults):
return TestPayload(backend=self, message=message, defaults=defaults)
def post_to_esp(self, payload, message):
- # Keep track of the send params (for test-case access)
- self.recorded_send_params.append(payload.params)
+ # Keep track of the sent messages and params (for test cases)
+ message.anymail_test_params = payload.params
+ mail.outbox.append(message)
try:
# Tests can supply their own message.test_response:
- response = message.test_response
+ response = message.anymail_test_response
if isinstance(response, AnymailAPIError):
raise response
except AttributeError:
@@ -49,14 +54,6 @@ class EmailBackend(AnymailBaseBackend):
raise AnymailAPIError('Unparsable test response')
-# Pre-v0.8 naming (immediately deprecated for this undocumented test feature)
-class TestBackend(object):
- def __init__(self, **kwargs):
- raise NotImplementedError(
- "Anymail's (undocumented) TestBackend has been renamed to "
- "'anymail.backends.test.EmailBackend'")
-
-
class TestPayload(BasePayload):
# For test purposes, just keep a dict of the params we've received.
# (This approach is also useful for native API backends -- think of
@@ -129,3 +126,16 @@ class TestPayload(BasePayload):
def set_esp_extra(self, extra):
# Merge extra into params
self.params.update(extra)
+
+
+class _EmailBackendWithRequiredSetting(EmailBackend):
+ """Test backend with a required setting `sample_setting`.
+
+ Intended only for internal use by Anymail settings tests.
+ """
+
+ def __init__(self, *args, **kwargs):
+ esp_name = self.esp_name
+ self.sample_setting = get_anymail_setting('sample_setting', esp_name=esp_name,
+ kwargs=kwargs, allow_bare=True)
+ super(_EmailBackendWithRequiredSetting, self).__init__(*args, **kwargs)
diff --git a/anymail/utils.py b/anymail/utils.py
index d245f66..7241d08 100644
--- a/anymail/utils.py
+++ b/anymail/utils.py
@@ -18,6 +18,10 @@ from six.moves.urllib.parse import urlsplit, urlunsplit
from .exceptions import AnymailConfigurationError, AnymailInvalidAddress
+
+BASIC_NUMERIC_TYPES = six.integer_types + (float,) # int, float, and (on Python 2) long
+
+
UNSET = object() # Used as non-None default value
diff --git a/django_anymail.egg-info/PKG-INFO b/django_anymail.egg-info/PKG-INFO
index dcf8bd6..6da7311 100644
--- a/django_anymail.egg-info/PKG-INFO
+++ b/django_anymail.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: django-anymail
-Version: 0.11.1
+Version: 1.0
Summary: Django email backends for Mailgun, Mailjet, Postmark, SendGrid, SparkPost and other transactional ESPs
Home-page: https://github.com/anymail/django-anymail
Author: Mike Edmunds <medmunds at gmail.com>
@@ -9,15 +9,6 @@ License: BSD License
Description: Anymail: Django email backends for Mailgun, Mailjet, Postmark, SendGrid, SparkPost and more
===========================================================================================
- **PRE-1.0**
-
- Although several projects are using this package in production,
- the API and feature set are still evolving, and the package has
- not yet reached 1.0 status. Before 1.0, minor version bumps might
- include breaking changes (following semantic versioning rules).
- Please check the
- `release notes <https://github.com/anymail/django-anymail/releases>`_
-
.. This README is reused in multiple places:
* Github: project page, exactly as it appears here
* Docs: shared-intro section gets included in docs/index.rst
@@ -47,7 +38,7 @@ Description: Anymail: Django email backends for Mailgun, Mailjet, Postmark, Send
built-in `django.core.mail` package. It includes:
* Support for HTML, attachments, extra headers, and other features of
- `Django's built-in email <https://docs.djangoproject.com/en/v0.11.1/topics/email/>`_
+ `Django's built-in email <https://docs.djangoproject.com/en/v1.0/topics/email/>`_
* Extensions that make it easy to use extra ESP functionality, like tags, metadata,
and tracking, with code that's portable between ESPs
* Simplified inline images for HTML email
@@ -61,19 +52,20 @@ Description: Anymail: Django email backends for Mailgun, Mailjet, Postmark, Send
.. END shared-intro
- .. image:: https://travis-ci.org/anymail/django-anymail.svg?branch=v0.11.1
+ .. image:: https://travis-ci.org/anymail/django-anymail.svg?branch=v1.0
:target: https://travis-ci.org/anymail/django-anymail
:alt: build status on Travis-CI
- .. image:: https://readthedocs.org/projects/anymail/badge/?version=v0.11.1
- :target: https://anymail.readthedocs.io/en/v0.11.1/
+ .. image:: https://readthedocs.org/projects/anymail/badge/?version=v1.0
+ :target: https://anymail.readthedocs.io/en/v1.0/
:alt: documentation on ReadTheDocs
**Resources**
- * Full documentation: https://anymail.readthedocs.io/en/v0.11.1/
+ * Full documentation: https://anymail.readthedocs.io/en/v1.0/
* Package on PyPI: https://pypi.python.org/pypi/django-anymail
* Project on Github: https://github.com/anymail/django-anymail
+ * Changelog: https://github.com/anymail/django-anymail/releases
Anymail 1-2-3
@@ -115,7 +107,7 @@ Description: Anymail: Django email backends for Mailgun, Mailjet, Postmark, Send
DEFAULT_FROM_EMAIL = "you at example.com" # if you don't already have this in settings
- 3. Now the regular `Django email functions <https://docs.djangoproject.com/en/v0.11.1/topics/email/>`_
+ 3. Now the regular `Django email functions <https://docs.djangoproject.com/en/v1.0/topics/email/>`_
will send through your chosen ESP:
.. code-block:: python
@@ -159,12 +151,12 @@ Description: Anymail: Django email backends for Mailgun, Mailjet, Postmark, Send
.. END quickstart
- See the `full documentation <https://anymail.readthedocs.io/en/v0.11.1/>`_
+ See the `full documentation <https://anymail.readthedocs.io/en/v1.0/>`_
for more features and options.
Keywords: django,email,email backend,ESP,transactional mail,mailgun,mailjet,mandrill,postmark,sendgrid
Platform: UNKNOWN
-Classifier: Development Status :: 2 - Pre-Alpha
+Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: Implementation :: CPython
diff --git a/setup.py b/setup.py
index f90bc34..b4cff12 100644
--- a/setup.py
+++ b/setup.py
@@ -53,7 +53,7 @@ setup(
test_suite="runtests.runtests",
tests_require=["mock", "sparkpost"],
classifiers=[
- "Development Status :: 2 - Pre-Alpha",
+ "Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: Implementation :: CPython",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-anymail.git
More information about the Python-modules-commits
mailing list