Browse files

Converting to use groups, rather than hard coded email addresses.

  • Loading branch information...
1 parent 2e84df7 commit 73f3812982f2945ce506fc1ce68d8a6dd1db9be9 @justinabrahms justinabrahms committed Feb 3, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 django_website/aggregator/management/commands/send_pending_approval_email.py
View
11 django_website/aggregator/management/commands/send_pending_approval_email.py
@@ -5,7 +5,8 @@
from __future__ import absolute_import
from django.conf import settings
-from django.core.mail import send_mail
+from django.contrib.auth.models import User
+from django.core import mail
from django.core.management.base import NoArgsCommand
from django.template import Context, Template
from ...models import Feed, PENDING_FEED
@@ -19,6 +20,7 @@ def handle_noargs(self, **kwargs):
verbosity = 1
feeds = Feed.objects.filter(approval_status=PENDING_FEED)
+ to_email = [x.email for x in User.objects.filter(groups__name=settings.FEED_APPROVERS_GROUP_NAME)]
if len(feeds) == 0:
if verbosity >= 1:
@@ -39,8 +41,9 @@ def handle_noargs(self, **kwargs):
print "Pending approval email:\n"
print message
- send_mail("django community feeds pending approval", message,
- 'nobody@djangoproject.com', settings.FEED_APPROVERS)
+ mail.send_mail("django community feeds pending approval", message,
+ 'nobody@djangoproject.com', to_email,
+ fail_silently=False)
if verbosity >= 1:
- print "Sent pending approval email to: %s" % (', '.join(settings.FEED_APPROVERS))
+ print "Sent pending approval email to: %s" % (', '.join(to_email))

0 comments on commit 73f3812

Please sign in to comment.