Ejemplo n.º 1
0
 def ministry_emails(self):
     ministry = dbutils.get_ministry(self.context.ministry_id)
     ministers = dbutils.get_ministers(ministry)
     return " ,".join([ 
             utils.formatted_user_email(minister) 
             for minister in ministers 
     ])
def sendNotificationToMinistry(date):
    """
    send a notification to the ministry stating
    all questions that are approaching the deadline
    """
    text = translate("notification_email_to_ministry_question_pending_response",
                     target_language="en",
                     domain="bungeni",
                     default="Questions pending responses.")
    ministries = _getAllMinistries(date)
    for ministry in ministries:
        questions = _getQuestionsPendingResponse(date, ministry)
        text = translate("notification_email_to_ministry_question_pending_response",
                     target_language="en",
                     domain="bungeni",
                     default="Questions assigned to the ministry pending responses.")
        if questions: 
            text = "%s\n%s: \n" % (text, ministry.full_name) + \
                "\n".join([ question.subject for question in questions ])
            emails = [ utils.formatted_user_email(minister)
                for minister in dbutils.get_ministers(ministry) ]
            msg = MIMEText(text)
            msg["Subject"] = "Questions pending response"
            msg["From"] = prefs.getClerksOfficeEmail()
            msg["To"] = " ,".join(emails)
            print msg
            # !+SENDMAIL(ah,18-03-2010)
            #Mail sending is commented out 
            dispatch(msg)
Ejemplo n.º 3
0
def sendNotificationToMinistry(date):
    """
    send a notification to the ministry stating
    all questions that are approaching the deadline
    """
    text = translate(
        "notification_email_to_ministry_question_pending_response",
        target_language="en",
        domain="bungeni",
        default="Questions pending responses.")
    ministries = _getAllMinistries(date)
    for ministry in ministries:
        questions = _getQuestionsPendingResponse(date, ministry)
        text = translate(
            "notification_email_to_ministry_question_pending_response",
            target_language="en",
            domain="bungeni",
            default="Questions assigned to the ministry pending responses.")
        if questions:
            text = "%s\n%s: \n" % (text, ministry.full_name) + \
                "\n".join([ question.subject for question in questions ])
            emails = [
                utils.formatted_user_email(minister)
                for minister in dbutils.get_ministers(ministry)
            ]
            msg = MIMEText(text)
            msg["Subject"] = "Questions pending response"
            msg["From"] = prefs.getClerksOfficeEmail()
            msg["To"] = " ,".join(emails)
            print msg
            # !+SENDMAIL(ah,18-03-2010)
            #Mail sending is commented out
            dispatch(msg)