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:
medmunds
2013-03-13 09:52:51 -07:00
parent 7484a39108
commit 64f32fbc72
3 changed files with 6 additions and 3 deletions

View File

@@ -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

View File

@@ -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"""

View File

@@ -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