[Tracker-discuss] [issue141] Should send email on assignment

David Linke metatracker at psf.upfronthosting.co.za
Fri Aug 31 09:58:28 CEST 2007


David Linke added the comment:

Here is some reactor code for the original idea to inform about assignment:

def notifywhenassignedto(db, cl, nodeid, oldvalues):
    '''Send mail to user who is newly assigned to an issue
    '''
    assigned_user = cl.get(nodeid,'assignedto')
    if oldvalues.has_key('assignedto'):
        old_assigned_user = oldvalues['assignedto']
    else:
        old_assigned_user = -1
    if assigned_user == db.getuid(): return # don't react on assign to self
    if assigned_user and assigned_user != old_assigned_user:
        try:
            address = [db.user.get(assigned_user,'address')]
        except KeyError, message:
            raise roundupdb.DetectorError, message
        change_note = ('\nThe issue linked below has been assigned to you!%s' %
                       cl.generateChangeNote(nodeid, oldvalues))
        # send mail
        try:
            msgid = None
            cl.send_message(nodeid, msgid, change_note, address)
            logging.getLogger('detector').info('notifywhenassignedto:'
                          ' Sent email for issue %s to %s' % (nodeid, address))
        except roundupdb.MessageSendError, message:
            raise roundupdb.DetectorError, message

def init(db):
    db.issue.react('set', notifywhenassignedto)

_______________________________________________________
Meta Tracker <metatracker at psf.upfronthosting.co.za>
<http://psf.upfronthosting.co.za/roundup/meta/issue141>
_______________________________________________________


More information about the Tracker-discuss mailing list