From: Chris Lamb Date: Thu, 29 Oct 2009 21:11:50 +0000 (+0000) Subject: Refactor Upload.package_info. X-Git-Url: https://git.decadent.org.uk/gitweb/?p=dak.git;a=commitdiff_plain;h=5ea1e82604956d2d93a6884137d780669bd2349d Refactor Upload.package_info. Signed-off-by: Chris Lamb --- diff --git a/daklib/queue.py b/daklib/queue.py index edd14d7e..bb5eb75f 100755 --- a/daklib/queue.py +++ b/daklib/queue.py @@ -287,16 +287,20 @@ class Upload(object): self.pkg.reset() def package_info(self): - msg = '' - - if len(self.rejects) > 0: - msg += "\n\nReject Reasons:\n%s" % "\n".join(self.rejects) + """ + Format various messages from this Upload to send to the maintainer. + """ - if len(self.warnings) > 0: - msg += "\n\nWarnings:\n%s" % "\n".join(self.warnings) + msgs = ( + ('Reject Reasons', self.rejects), + ('Warnings', self.warnings), + ('Notes', self.notes), + ) - if len(self.notes) > 0: - msg += "\n\nNotes:\n%s" % "\n".join(self.notes) + msg = '' + for title, messages in reasons: + if messages: + msg += '\n\n%s:\n%s' % (title, '\n'.join(messages)) return msg