def application_notify(application, action): recipients, subject, template = APPLICATION_DATA[action](application) try: build_notification( SENDER, recipients, subject, template=template, dictionary={'object': application} ).send() except NotificationError, e: logger.error(e.message)
def project_reinstatement_notify(project): try: build_notification( SENDER, [project.application.owner.email], _(messages.PROJECT_REINSTATEMENT_SUBJECT) % project.__dict__, template='im/projects/project_reinstatement_notification.txt', dictionary={'object': project} ).send() except NotificationError, e: logger.error(e.message)
def project_unsuspension_notify(project): try: build_notification( SENDER, [project.application.owner.email], _(messages.PROJECT_UNSUSPENSION_SUBJECT) % project.__dict__, template='im/projects/project_unsuspension_notification.txt', dictionary={'object': project} ).send() except NotificationError, e: logger.error(e.message)
def application_notify(application, action): recipients, subject, template = APPLICATION_DATA[action](application) try: build_notification(SENDER, recipients, subject, template=template, dictionary={ 'object': application }).send() except NotificationError, e: logger.error(e.message)
def project_termination_notify(project): app = project.application try: build_notification( SENDER, [project.application.owner.email], _(messages.PROJECT_TERMINATION_SUBJECT) % app.__dict__, template='im/projects/project_termination_notification.txt', dictionary={'object': project} ).send() except NotificationError, e: logger.error(e.message)
def membership_request_notify(project, requested_user, action): owner = project.owner if owner is None: return subject, template = MEMBERSHIP_REQUEST_DATA[action](project) try: build_notification( SENDER, [owner.email], subject, template=template, dictionary={'object': project, 'user': requested_user.email} ).send() except NotificationError, e: logger.error(e.message)
def project_notify(project, action): owner = project.owner if owner is None: return subject, template = PROJECT_DATA[action](project) try: build_notification( SENDER, [owner.email], subject, template=template, dictionary={'object': project} ).send() except NotificationError, e: logger.error(e.message)
def project_notify(project, action): owner = project.owner if owner is None: return subject, template = PROJECT_DATA[action](project) try: build_notification(SENDER, [owner.email], subject, template=template, dictionary={ 'object': project }).send() except NotificationError, e: logger.error(e.message)
def membership_request_notify(project, requested_user, action): owner = project.owner if owner is None: return subject, template = MEMBERSHIP_REQUEST_DATA[action](project) try: build_notification(SENDER, [owner.email], subject, template=template, dictionary={ 'object': project, 'user': requested_user.email }).send() except NotificationError, e: logger.error(e.message)
def membership_enroll_notify(project, user): try: notification = build_notification( SENDER, [user.email], MEM_ENROLL_NOTIF['subject'] % project.__dict__, template=MEM_ENROLL_NOTIF['template'], dictionary={'object': project}) notification.send() except NotificationError, e: logger.error(e.message)
def application_submit_notify(application): try: notification = build_notification( SENDER, NOTIFY_RECIPIENTS, _(messages.PROJECT_CREATION_SUBJECT) % application.__dict__, template='im/projects/project_creation_notification.txt', dictionary={'object': application}) notification.send() except NotificationError, e: logger.error(e.message)
def membership_change_notify(project, user, action): try: notification = build_notification( SENDER, [user.email], MEM_CHANGE_NOTIF['subject'] % project.__dict__, template=MEM_CHANGE_NOTIF['template'], dictionary={'object': project, 'action': action}) notification.send() except NotificationError, e: logger.error(e.message)
def membership_request_notify(project, requested_user): try: notification = build_notification( SENDER, [project.application.owner.email], _(messages.PROJECT_MEMBERSHIP_REQUEST_SUBJECT) % project.__dict__, template='im/projects/project_membership_request_notification.txt', dictionary={'object': project, 'user': requested_user.email}) notification.send() except NotificationError, e: logger.error(e.message)
def application_approve_notify(application): try: notification = build_notification( SENDER, [application.owner.email], _(messages.PROJECT_APPROVED_SUBJECT) % application.__dict__, template='im/projects/project_approval_notification.txt', dictionary={'object': application}) notification.send() except NotificationError, e: logger.error(e.message)
def application_approved_admins_notify(application, previous_state): recipients = [] for name, mail in list(settings.PROJECT_NOTIFICATIONS_RECIPIENTS): recipients.append(mail) try: notification = build_notification( SENDER, recipients, APPLICATION_APPROVED_NOTIF['subject'].format(application.chain.name), template=APPLICATION_APPROVED_NOTIF['template'], dictionary={ 'application': application, 'previous_state': previous_state } ) notification.send() except NotificationError, e: logger.error(e.message)
def application_approved_admins_notify(application, previous_state): recipients = [] for name, mail in list(settings.PROJECT_NOTIFICATIONS_RECIPIENTS): recipients.append(mail) try: notification = build_notification( SENDER, recipients, APPLICATION_APPROVED_NOTIF['subject'].format( application.chain.name), template=APPLICATION_APPROVED_NOTIF['template'], dictionary={ 'application': application, 'previous_state': previous_state }) notification.send() except NotificationError, e: logger.error(e.message)