Skip to content

Commit

Permalink
the message to send is now saved as self.msg for poking with sticks i…
Browse files Browse the repository at this point in the history
…n the console
  • Loading branch information
alexlovelltroy committed Oct 29, 2013
1 parent ea5fc8c commit ff6a58f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions classy_mail/generic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
logger = logging.getLogger("classy_mail")
from django.conf import settings
from django.template import Template, Context ,loader
from django.template import Template, Context ,loader, TemplateDoesNotExist
from django.contrib.sites.models import Site
from django.core.mail import EmailMultiAlternatives
from .models import EmailTemplate
Expand All @@ -21,7 +21,10 @@ def _resolve_template(template):
if isinstance(template, (list, tuple)):
return loader.select_template(template)
elif isinstance(template, basestring):
return loader.get_template(template)
try:
return loader.get_template(template)
except TemplateDoesNotExist:
return None
else:
return template

Expand All @@ -31,6 +34,7 @@ def _resolve_template(template):
class BaseEmail(object):
_msg = None
from_email = settings.DEFAULT_FROM_EMAIL
context = dict()
#TODO: Separate getting the template from rendering it

def __init__(self, **kwargs):
Expand Down Expand Up @@ -83,8 +87,8 @@ def get_html_content(self):


def send(self):
msg = self.build_msg()
msg.send()
self.msg = self.build_msg()
self.msg.send()


class BaseTemplateMixin(object):
Expand Down

0 comments on commit ff6a58f

Please # to comment.