From a7c5a8753a6ba65b13c8720f99473b89589392e5 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 13 Feb 2017 16:03:22 +0100 Subject: [PATCH] Fixing lib/webhooks/__init__.py for the case not committers were found. --- lib/webhooks/__init__.py | 2 +- lib/webhooks/deploy.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/webhooks/__init__.py b/lib/webhooks/__init__.py index 52d4672..4bafe80 100644 --- a/lib/webhooks/__init__.py +++ b/lib/webhooks/__init__.py @@ -1,6 +1,6 @@ #!/bin/env python3 # -*- coding: utf-8 -*- -__version__ = '0.3.5' +__version__ = '0.3.6' # vim: ts=4 et list diff --git a/lib/webhooks/deploy.py b/lib/webhooks/deploy.py index 1552a4b..ca32149 100644 --- a/lib/webhooks/deploy.py +++ b/lib/webhooks/deploy.py @@ -580,11 +580,14 @@ class WebhookDeployApp(object): timestamp = datetime.datetime.strptime(ts_str, timeformat) email = commit['author']['email'] committers.append((timestamp, email)) - committers.sort() - if self.verbose > 1: - LOG.debug("Got committers: {}".format(pp(committers))) - self.mail_to_addresses.append(committers[-1][1]) + if committers: + committers.sort() + if self.verbose > 1: + LOG.debug("Got committers: {}".format(pp(committers))) + self.mail_to_addresses.append(committers[-1][1]) + else: + LOG.debug("No committers found to append a mail address.") if 'git_ssh_url' in self.json_data['project']: self.git_ssh_url = self.json_data['project']['git_ssh_url'] -- 2.39.5