]> git.decadent.org.uk Git - dak.git/commitdiff
Refactor Upload.package_info.
authorChris Lamb <lamby@debian.org>
Thu, 29 Oct 2009 21:11:50 +0000 (21:11 +0000)
committerChris Lamb <lamby@debian.org>
Thu, 29 Oct 2009 21:11:50 +0000 (21:11 +0000)
Signed-off-by: Chris Lamb <lamby@debian.org>
daklib/queue.py

index edd14d7e231b4d1ca2c54aa25502024e877a7ce7..bb5eb75f444996e9ae79c44f3e934b960db57895 100755 (executable)
@@ -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