Move MANDRILL_API_URL to package root (out of backend)

This commit is contained in:
medmunds
2013-01-11 17:34:17 -08:00
parent ad4b9f38ff
commit 8f9afdff7e
3 changed files with 11 additions and 9 deletions

View File

@@ -1,9 +1,15 @@
from django.conf import settings
from django.contrib.admin.sites import AdminSite from django.contrib.admin.sites import AdminSite
from django.utils.text import capfirst from django.utils.text import capfirst
VERSION = (0, 2, 0) VERSION = (0, 2, 0)
__version__ = '.'.join([str(x) for x in VERSION]) __version__ = '.'.join([str(x) for x in VERSION])
# This backend was developed against this API endpoint.
# You can override in settings.py, if desired.
MANDRILL_API_URL = getattr(settings, "MANDRILL_API_URL",
"http://mandrillapp.com/api/1.0")
from exceptions import MandrillAPIError, NotSupportedByMandrillError from exceptions import MandrillAPIError, NotSupportedByMandrillError
class DjrillAdminSite(AdminSite): class DjrillAdminSite(AdminSite):

View File

@@ -5,8 +5,8 @@ from django.core.mail.message import sanitize_address, DEFAULT_ATTACHMENT_MIME_T
from django.utils import simplejson as json 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 MandrillAPIError, NotSupportedByMandrillError #from djrill import MANDRILL_API_URL, MandrillAPIError, NotSupportedByMandrillError
from ... import MandrillAPIError, NotSupportedByMandrillError 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
@@ -14,10 +14,6 @@ from email.utils import parseaddr
import mimetypes import mimetypes
import requests import requests
# This backend was developed against this API endpoint.
# You can override in settings.py, if desired.
MANDRILL_API_URL = "http://mandrillapp.com/api/1.0"
DjrillBackendHTTPError = MandrillAPIError # Backwards-compat Djrill<=0.2.0 DjrillBackendHTTPError = MandrillAPIError # Backwards-compat Djrill<=0.2.0
class DjrillBackend(BaseEmailBackend): class DjrillBackend(BaseEmailBackend):
@@ -31,7 +27,7 @@ class DjrillBackend(BaseEmailBackend):
""" """
super(DjrillBackend, self).__init__(**kwargs) super(DjrillBackend, self).__init__(**kwargs)
self.api_key = getattr(settings, "MANDRILL_API_KEY", None) self.api_key = getattr(settings, "MANDRILL_API_KEY", None)
self.api_url = getattr(settings, "MANDRILL_API_URL", MANDRILL_API_URL) self.api_url = MANDRILL_API_URL
if not self.api_key: if not self.api_key:
raise ImproperlyConfigured("You have not set your mandrill api key " raise ImproperlyConfigured("You have not set your mandrill api key "

View File

@@ -5,7 +5,7 @@ from django.core.exceptions import ImproperlyConfigured
from django.utils import simplejson as json from django.utils import simplejson as json
from django.views.generic import TemplateView from django.views.generic import TemplateView
from djrill.mail.backends.djrill import MANDRILL_API_URL from djrill import MANDRILL_API_URL
import requests import requests
@@ -25,7 +25,7 @@ class DjrillApiMixin(object):
""" """
def __init__(self): def __init__(self):
self.api_key = getattr(settings, "MANDRILL_API_KEY", None) self.api_key = getattr(settings, "MANDRILL_API_KEY", None)
self.api_url = getattr(settings, "MANDRILL_API_URL", MANDRILL_API_URL) self.api_url = MANDRILL_API_URL
if not self.api_key: if not self.api_key:
raise ImproperlyConfigured("You have not set your mandrill api key " raise ImproperlyConfigured("You have not set your mandrill api key "