Revision 71a38edf snf-astakos-app/astakos/im/notifications.py
b/snf-astakos-app/astakos/im/notifications.py | ||
---|---|---|
36 | 36 |
|
37 | 37 |
from django.conf import settings |
38 | 38 |
from django.core.mail import send_mail |
39 |
from django.utils.translation import ugettext as _ |
|
39 | 40 |
|
40 | 41 |
import astakos.im.messages as astakos_messages |
41 | 42 |
|
42 | 43 |
logger = logging.getLogger(__name__) |
43 | 44 |
|
44 |
def build_notification(): |
|
45 |
def build_notification(sender, recipients, subject, message):
|
|
45 | 46 |
return EmailNotification(sender, recipients, subject, message) |
46 | 47 |
|
47 | 48 |
class Notification(object): |
... | ... | |
58 | 59 |
def send(self): |
59 | 60 |
try: |
60 | 61 |
send_mail( |
61 |
subject, |
|
62 |
message, |
|
63 |
sender, |
|
64 |
recipients |
|
62 |
self.subject,
|
|
63 |
self.message,
|
|
64 |
self.sender,
|
|
65 |
self.recipients
|
|
65 | 66 |
) |
66 |
except: |
|
67 |
except BaseException, e: |
|
68 |
logger.exception(e) |
|
67 | 69 |
raise SendNotificationError() |
68 | 70 |
|
69 | 71 |
class SendMailError(Exception): |
Also available in: Unified diff