From 2f3f3ecd39aaa856d833e57bb1f09b270c413f02 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 9 Oct 2013 09:40:02 -0400 Subject: [PATCH] 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 --- elastic_recheck/elasticRecheck.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/elastic_recheck/elasticRecheck.py b/elastic_recheck/elasticRecheck.py index f53edade..13d423b2 100755 --- a/elastic_recheck/elasticRecheck.py +++ b/elastic_recheck/elasticRecheck.py @@ -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/"