Commit Graph

359 Commits

Author SHA1 Message Date
medmunds
ef971489cd Start factoring out common backend functionality 2016-02-29 11:52:35 -08:00
medmunds
1c7fe8a759 Rename exceptions
* Change Djrill -> Mandrill in exception names
* Don't re-export at package level
  (import from anymail.exceptions, not from anymail)
2016-02-27 12:03:45 -08:00
medmunds
921dd5d0d6 Fork from Djrill and rename to "anymail" 2016-02-27 11:16:04 -08:00
medmunds
f95d5d66dc Avoid weak ref to local signal receiver in webhook tests.
Webhook tests define a local signal receiver function,
so connect it using the `weak=False` option to set
a good example.

(This isn't technically needed in the tests: the test receivers
are only connected while their definitions are still in scope,
so they couldn't possibly be garbage collected. But it doesn't
hurt, and it's good practice in case the test code gets copied.)

Also update the webhook docs to have a direct link to
Django's "listening to signals" info.
2016-02-04 12:14:01 -08:00
medmunds
9c938c8e85 Fix webhook tests for pypy
(Disconnect signal receivers after
we're done with them, to avoid
confusion between test cases.)
2016-02-03 19:42:01 -08:00
medmunds
79eaac42c4 Handle Mandrill sync event webhooks
Fixes #108
2016-02-03 19:29:26 -08:00
medmunds
5d4440ef5d Open v2.1 development
[ci skip]
2015-12-02 20:06:32 -08:00
medmunds
48028ecf64 Switch back to python-approved versioning
2.0.0-dev0 --> 2.0.0.dev0 (or just 2.0.dev0)

We still practice semver in the major.minor.patch
versions; we just don't use semver's "-" for
pre-release versions. (Because, PEP 0440.)

https://www.python.org/dev/peps/pep-0440/
2015-12-02 19:50:28 -08:00
Mike Edmunds
68929e015e Merge pull request #105 from brack3t/v2.0-dev
Move master to v2.0
2015-12-02 18:51:01 -08:00
medmunds
ed77987552 Docs: couple more release notes 2015-12-02 18:39:08 -08:00
medmunds
7706a5d39f Docs: 2.0 upgrade guide, release notes 2015-12-02 18:25:26 -08:00
medmunds
c625b6f12f Add .editorconfig and CONTRIBUTING.md 2015-12-02 17:22:02 -08:00
medmunds
d496555813 Docs: remove pre-2.0 versionadded/versionchanged
(Cut the old-version clutter)
2015-12-02 17:06:15 -08:00
medmunds
265c7460e0 Support Django 1.9 release 2015-12-02 16:59:34 -08:00
medmunds
02641b0959 Improve send_at docs
* Try to clear up timezones
* Note requirement for funded account
2015-12-02 16:52:42 -08:00
medmunds
d82d425aa8 Clean up mandrill_reponse docs
Document mandrill_response as an attribute
(not just a generic topic).
2015-12-02 16:18:57 -08:00
medmunds
9971c1780f Document MANDRILL_API_URL 2015-12-02 16:10:29 -08:00
medmunds
aa46fadb48 Clean up global MANDRILL_SETTINGS
* Clean up Djrill backend __init__
* Fold MANDRILL_SUBACCOUNT into
  global_settings logic
* Add some missing override tests
* Update docs
2015-12-02 15:58:23 -08:00
medmunds
5c39e40ea1 Use urljoin to build api endpoint
(String arithmetic was probably OK
for our limited use case, but in general
is a bad idea for constructing urls.)
2015-12-02 14:21:53 -08:00
medmunds
fe1e2d1ae5 Refactor backend
* Break apart massive _send call
* Try to facilitate subclassing
* Centralize fail_silently handling during _send
* Include original EmailMessage as exception attr
2015-12-02 12:41:26 -08:00
medmunds
b8cdc6ce82 Cleanup Djrill exceptions
* Add common base DjrillException

* Simplify backend by moving logic
  to describe errors into base DjrillException

* Add NotSerializableForMandrillError
  for JSON serialization errors
2015-12-02 10:52:20 -08:00
medmunds
221530ae11 Fix tests on python 3 2015-12-01 13:57:45 -08:00
medmunds
d14b87c910 Raise error for invalid/rejected recipients
Raise new MandrillRecipientsRefused exception
when Mandrill returns 'reject' or 'invalid' status
for *all* recipients of a message.

(Similar to Django's SMTP email backend raising
SMTPRecipientsRefused.)

Add setting MANDRILL_IGNORE_RECIPIENT_STATUS
to override the new exception.

Trap JSON parsing errors in Mandrill API response,
and raise MandrillAPIError for them. (Helps with #93.)

Closes #80.
Closes #81.
2015-12-01 13:26:21 -08:00
medmunds
8433e6d660 Clean up all imports
* Use relative imports within djrill package
* Standardize ordering
* Remove absolute_import (it's standard in all
  python versions we now support)
2015-11-30 17:33:08 -08:00
medmunds
632334b426 Don't access MANDRILL_API_URL setting at module level
Move MANDRILL_API_URL setting lookup into Djrill
backend init (where it's used).

Because "modules should not in general use settings
stored in django.conf.settings at the top level".
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#use-of-django-conf-settings
2015-11-30 17:20:27 -08:00
medmunds
3a6e0ebb30 Clean up session sharing
* Test cases
* Fix premature session.close when caller
  is managing email backend connection
* Ensure session closed correct in exceptions
* Changelog

(Also fixes bug where JSON serialization errors
didn't respect fail_silently.)
2015-11-30 16:50:58 -08:00
medmunds
4089a35500 Drop legacy tests and deprecations 2015-11-29 14:45:08 -08:00
medmunds
942a6df8c3 Drop unintended json date encoding 2015-11-29 14:42:12 -08:00
medmunds
699216ba00 Drop legacy DjrillBackendHTTPError exception 2015-11-29 12:55:16 -08:00
medmunds
209f9573ff Drop legacy DjrillMessage class 2015-11-29 12:37:00 -08:00
medmunds
681af234bd Travis: avoid legacy infrastructure; enable caching 2015-09-25 18:29:15 -07:00
medmunds
f7bd9f3a25 Add Djrill version to User-Agent header
(Makes version show up in Mandrill API logs)
2015-09-25 18:23:45 -07:00
medmunds
e06f2cf718 Travis: make build matrix more readable (by humans) 2015-09-25 17:50:44 -07:00
medmunds
3b4d1c1359 Travis: list installed package versions in build log 2015-09-25 17:19:51 -07:00
medmunds
42848e0eed Integration tests handle 'queued' response
Rapid-fire pelting from our Travis tests sometimes
causes the Mandrill API to queue a "send" call, rather
than deal with it immediately. If that occurs, we
generally have to just ignore that test (in that test run).
2015-09-25 14:48:32 -07:00
Mike Edmunds
1ce7f98375 Add Django 1.9 alpha to test matrix 2015-09-25 12:02:42 -07:00
Mike Edmunds
23523389be Merge pull request #99 from Wrhector/v2.0-dev3
Allow Mandrill specific options to be set globally in the settings file.

Closes #97
2015-07-14 11:33:03 -07:00
William Hector
7179734a08 Allow global_merge_vars to be merged in with the per message dict, with keys in the latter taking precedent.
Update the docs accordingly.
2015-07-14 05:57:12 +01:00
Mike Edmunds
c8b760e8fa Merge pull request #98 from Wrhector/v2.0-dev
Use requests.session to pool requests when mass sending mail
2015-07-13 16:21:39 -07:00
William Hector
883b23362c Allow Mandrill specific options to be set globally in the settings file.
This is useful to set options such as tracking_domain etc per instance when using subaccounts with Mandrill.
2015-07-12 01:19:59 +01:00
William Hector
bac85511b5 Use requests.session to pool requests when mass sending mail
Tests modified to patch the ression post and close session upon error.
RE: http://stackoverflow.com/q/30982717/647002
2015-07-11 22:12:14 +01:00
medmunds
da260de1a0 Drop support for Django 1.3, Python 2.6 and 3.2.
* Shrink the Travis test matrix
* Remove a lot of backported test code
* Update requirements in setup.py
* Update docs

Closes #79
2015-05-14 11:39:57 -07:00
medmunds
99ac099081 Remove DjrillAdminSite
Closes #78
2015-05-14 11:00:52 -07:00
medmunds
a658e12595 2.0 development branch 2015-05-14 10:10:42 -07:00
medmunds
1d086f85f4 Close out 1.4 dev
Master is now 1.5.0-dev (to avoid accidents),
but the 1.4 branch is expected to be the end
of the 1.x line.

2.0 development will begin on a separate branch soon.
2015-05-13 20:18:11 -07:00
medmunds
a6d4911d9b Travis: upgrade pip and setuptools at start of build
Hoping to clean up some warnings while installing dependencies.
2015-05-13 19:49:25 -07:00
medmunds
ef0051dd36 Docs: point to Django stable docs
Avoid pointing Djrill users toward Django dev docs.

[ci skip]
2015-05-13 18:56:15 -07:00
medmunds
c83aee0bf2 Update the docs copyright year
(Didn't realize we had a docs copyright year.)
2015-05-13 18:47:18 -07:00
medmunds
46dea8d595 Fix missing Sphinx labels
(So we don't send would-be Djrill contributors
to Django's "Contributors Guide".)
2015-05-13 18:46:07 -07:00
medmunds
7c46bc7d96 Add troubleshooting docs 2015-05-13 18:03:28 -07:00