Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(7)  |  Derive(0)  |  Import(2)
Send out notification. 

        def notify(notification_id, context, from_addr, to_addr):

    """ Send out notification. """

    # Check on to address, wheter it contains our onw mailbox. This is
    # generally a bad idea (tm), as we found out some day.
    to_addr = ", ".join(filter(
            lambda x: x not in settings.NOTIFICATION_BLACKLIST,
            to_addr.split(", ")))
    
    if not to_addr:
        LOGGER.error("No 'to' address set; bye now")
        return 

    template = settings.NOTIFICATION_MAP.get(notification_id, 
                                             "notification/%s.html" % \
                                                 notification_id)

    context.update({"from": from_addr or settings.DEFAULT_FROM_ADDR, 
                    "to": to_addr})

    if not template:
        LOGGER.error("No template found for %s" % notification_id)
        return

    try:
        message = str(render_to_string(template, context))
        
        email_message = Parser().parsestr(message)

        LOGGER.debug("Sending out notification %s to %s" % (notification_id, email_message['to']))

        send_mail(email_message['subject'], 
                  email_message.get_payload(), 
                  email_message['from'],
                  email_message['to'].split(","),
                  fail_silently=False)
    except:
        LOGGER.exception("Couldn't render template, no mail sent")
        


src/m/r/mrwolfe-1.1.0b/mrwolfe/utils.py   mrwolfe(Download)
from mrwolfe.models.sla import SLA
from mrwolfe.models.issue import Issue
from notification import notify
 
 
            sender = Contact.objects.create(email=from_addr)
        else:
            notify("issue_bounced", {}, send_from, from_addr)
            return False
    else:
        sender = Contact.objects.filter(email=from_addr)[0]
 
    if sla and not sla.is_contact(sender) and not \
            settings.ALLOW_NON_CONTACTS:
        notify("issue_bounced", {}, send_from, from_addr)
        att.save()
 
    notify("issue_received", 
           {"issue": issue}, 
           issue.email_from,

src/m/r/mrwolfe-HEAD/mrwolfe/utils.py   mrwolfe(Download)
from mrwolfe.models.sla import SLA
from mrwolfe.models.issue import Issue
from notification import notify
 
 
            sender = Contact.objects.create(email=from_addr)
        else:
            notify("issue_bounced", {}, send_from, from_addr)
            return False
    else:
        sender = Contact.objects.filter(email=from_addr)[0]
 
    if sla and not sla.is_contact(sender) and not \
            settings.ALLOW_NON_CONTACTS:
        notify("issue_bounced", {}, send_from, from_addr)
        att.save()
 
    notify("issue_received",
           {"issue": issue},
           issue.email_from,

src/m/n/mntv-HEAD/plugins/bittorrent.py   mntv(Download)
        out.write(' Torrent ID "%s"\n' % tkey)
      tkey = torrent._fields['id'].value
      notification.notify(socket.gethostbyname(socket.gethostname()),'MythNetTV downloads', 'Added a new torrent to download. %s' % (tc.get_torrent(tkey).name), tkey)
    except transmissionrpc.TransmissionError, e:
      out.write('Failed to add torrent "%s"' % e)