[Buildbot-devel] problem with email notifications

Stephen Davis stephendavis at mac.com
Mon Jul 11 21:17:37 UTC 2005


On Jul 9, 2005, at 1:46 AM, Brian Warner wrote:

> You may want to use 'addresses.get(user)' if you want to ignore  
> unknown
> users. addresses['unknown'] raises a KeyError, addresses.get 
> ('unknown')
> returns None, addresses.get('unknown', 'DEFAULT') returns  
> 'DEFAULT'. Given
> the DeferredList, I'm not actually positive what the behavior would  
> be in the
> face of an error. It's possible that it would ignore the lookup  
> error, or
> that it might try to use the resulting Failure object as an email  
> address,
> which would result in a pretty mangled To: header.

That seems to have done the trick.  I just changed my lookup class  
method to be:

class MyLookup:
     from buildbot import interfaces
     if implements:
         implements( interfaces.IEmailLookup )
     else:
         __implements__ = interfaces.IEmailLookup,
     def getAddress( self, user ):
         addresses = {    'user1' : user1 at xxx.com',
                         'user2' : 'user2 at xxx.com',
                         'stephend' : 'stephend at xxx.com'
                     }
          return addresses.get(user)

thanks,
stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20050711/ff881382/attachment.html>


More information about the devel mailing list