#!/usr/bin/env PYTHONPATH="/var/hostings/05pcon0912/us.pycon.org/apps07" DJANGO_SETTINGS_MODULE="pycon.conf.settings" python2.4
import sys, os
sys.path.insert(0, "/var/hostings/05pcon0912/us.pycon.org/apps07")
os.environ['DJANGO_SETTINGS_FILE'] = "pycon.conf.settings"
from django.conf import settings
from pycon.conf import settings as pycon_settings
#settings.configure(default_settings=pycon_settings)

from django.template import RequestContext, Context, loader
from pycon.core import mail
from pycon.propmgr.models import *
from django.contrib.auth.models import *

SUBJECT = "PyCon 2007 - Talk Proposal Revision Deadline Friday 11/10 1:00PM EST"
MESSAGE = """
The PyCon2007 Program Committee will be making the final decisions on
proposals starting Friday 11/10. At that time the proposals will be
frozen, and the proposal app will be closed to authors. Please take this time
to make any final changes and respond to any comments left by program
committee members.

You can review and edit your proposals with the
`Proposal System <http://us.pycon.org/apps07/proposals/>`_.

Final decisions will be sent by e-mail with the review comments on or
before November 22nd. At that time the proposal application will be opened
back up to authors for feedback comments.

Douglas A. Napoleone, on behalf of the PyCon Program Committee
pycon@dougma.com
http://us.pycon.org 
"""
FROM = 'pycon@dougma.com'

def send_notice(to):
    mailings = [ (SUBJECT, MESSAGE, FROM, [addr]) for addr in to ]
    return mail.send_mass_mail(mailings)

def send_to_authors():
    sent = send_notice(user.email for user in Group.objects.get(name='Authors').user_set.all())
    print "Sent %d e-mails" % sent
    
if __name__ == '__main__':
    send_to_authors()
    #send_notice('doug@dougma.com', 'doug.napoleone@nuance.com') #test
    
