[Buildbot-devel] customMesg for mail.MailNotifier ...

Kiffin Gish kiffin.gish at planet.nl
Tue Aug 25 18:26:15 UTC 2009


I've defined my own user-defined custom message function for email
notifications. It works pretty well, except for attrs['changes'] and
attrs['reason'] whose formatting could be better.

I'm pretty much a newbie when it comes to programming in Python, so I
was hoping someone could help me. The best I can do is the following:

if attrs['buildProperties']:
        text.append('Build properties : %s' % attrs['buildProperties'])

which gives me this:

Build properties : {'scheduler': 'code_changed', 'buildername':
'builder-cmt-web-make', 'got_revision': '1360', 'warnings-count': 0,
'buildnumber': 9, 'slavename': 'slave-dev1', 'branch': None, 'os':
'Linux', 'revision': '1360'}

and:

if len(attrs['changes']):
    text.append('Changes : %s' % [c.asText() for c in attrs['changes']])

which gives me this:

Changes : [u'File: file1\nAt: Tue 25 Aug 2009 17:27:01\nChanged By:
kgish\nComments: Comments for file1\n\n\n', u'File: file2\nAt: Tue 25
Aug 2009 17:27:01\nChanged By: kgish\nComments: Comments for file2\n\n
\n', u'File: file3\nAt: Tue 25 Aug 2009 17:27:02\nChanged By: bartx
\nComments: Comments for file3\n\n\n']

How can I extract the separate items and make it look something like
this?

Build properties : 
  Scheduler      : code_changed,
  Builder name   : builder-cmt-web-make
  Got revision   : 1360
  Warnings count : 0
  Build number   : 9
  Slave Name     : slave-dev1
  Branch         : None
  OS             : Linux
  Revision       : 1360

Changes : 
  kgish : file1 at Tue 25 Aug 2009 17:27:01 (Comments for file1)
  kgish : file2 at Tue 25 Aug 2009 17:27:01 (Comments for file2)
  bartx : file3 at Tue 25 Aug 2009 17:27:02 (Comments for file3)

(Based on this blame list I want to be the bad guy and send them a nasty
email asking them politely to fix this)

Thanks alot in advance!

-- 
Kiffin Gish <Kiffin.Gish at planet.nl>
Gouda, The Netherlands






More information about the devel mailing list