mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Use python's json rather than Django's
django.utils.simplejson is deprecated; Python 2.6+ includes json. Fixes #32.
This commit is contained in:
@@ -2,7 +2,6 @@ from django.conf import settings
|
|||||||
from django.core.exceptions import ImproperlyConfigured
|
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 django.utils import simplejson as json
|
|
||||||
|
|
||||||
# Oops: this file has the same name as our app, and cannot be renamed.
|
# Oops: this file has the same name as our app, and cannot be renamed.
|
||||||
#from djrill import MANDRILL_API_URL, MandrillAPIError, NotSupportedByMandrillError
|
#from djrill import MANDRILL_API_URL, MandrillAPIError, NotSupportedByMandrillError
|
||||||
@@ -11,11 +10,13 @@ from ... import MANDRILL_API_URL, MandrillAPIError, NotSupportedByMandrillError
|
|||||||
from base64 import b64encode
|
from base64 import b64encode
|
||||||
from email.mime.base import MIMEBase
|
from email.mime.base import MIMEBase
|
||||||
from email.utils import parseaddr
|
from email.utils import parseaddr
|
||||||
|
import json
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
DjrillBackendHTTPError = MandrillAPIError # Backwards-compat Djrill<=0.2.0
|
DjrillBackendHTTPError = MandrillAPIError # Backwards-compat Djrill<=0.2.0
|
||||||
|
|
||||||
|
|
||||||
class DjrillBackend(BaseEmailBackend):
|
class DjrillBackend(BaseEmailBackend):
|
||||||
"""
|
"""
|
||||||
Mandrill API Email Backend
|
Mandrill API Email Backend
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import json
|
||||||
from mock import patch
|
from mock import patch
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import simplejson as json
|
|
||||||
|
|
||||||
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"""
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.utils import simplejson as json
|
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
from djrill import MANDRILL_API_URL
|
from djrill import MANDRILL_API_URL
|
||||||
|
|||||||
Reference in New Issue
Block a user