use join to list multiple bugs

previously when we had multiple bugs we did looped string appends,
but that meant we had a trailing "and", which was ugly. We can
do better by transforming bugs to bug_urls, then using join.

Change-Id: Iaf28dbe9909c60b1e2206a79faaf5190f792252d
This commit is contained in:
Sean Dague 2013-10-09 09:40:02 -04:00
parent 074d6ae340
commit 2f3f3ecd39

View File

@ -82,12 +82,9 @@ class Stream(object):
def leave_comment(self, project, commit, bugs=None):
if bugs:
message = "I noticed tempest failed, I think you hit bugs:"
if len(bugs) > 1:
for bug in bugs:
message += ' https://bugs.launchpad.net/bugs/%s and' % bug
else:
message += ' https://bugs.launchpad.net/bugs/%s' % bugs[0]
message = "I noticed tempest failed, I think you hit bug(s): "
bug_urls = ['https://bugs.launchpad.net/bugs/%s' % x for x in bugs]
message += " and ".join(bug_urls)
else:
message = ("I noticed tempest failed, refer to: "
"https://wiki.openstack.org/wiki/"