Initial notifications draft

This commit is contained in:
Fergal Moran
2013-05-03 13:46:52 +01:00
parent 4af23f5aca
commit dc830b8a82
2 changed files with 12 additions and 2 deletions

View File

@@ -260,6 +260,10 @@ mimetypes.add_type("text/xml", ".plist", False)
HTML_MINIFY = not localsettings.DEBUG
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
if DEBUG:
import mimetypes
mimetypes.add_type("image/png", ".png", True)

View File

@@ -1,6 +1,6 @@
import logging
import urlparse
from avatar.views import notification
from notification import models as notification
from django.contrib.auth.models import User
from django.core.exceptions import SuspiciousOperation
@@ -88,7 +88,13 @@ class UserProfile(_BaseModel):
def add_follower(self, user):
self.followers.add(user)
notification.send(self.user, "new_follower", {"from_user": "admin@deepsouthsounds.com"})
try:
notification.send([self.user], "new_follower", {"from_user": "admin@deepsouthsounds.com"})
except Exception, ex:
self.logger.warning("Unable to send email for new follower")
self.logger.warning("Host: %s" % settings.EMAIL_HOST)
self.logger.warning("Port: %s" % settings.EMAIL_PORT)
self.logger.warning("Backend: %s" % settings.EMAIL_BACKEND)
def is_follower(self, user):
try: