[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master 3/3] Refactor Upload.package_info.



Signed-off-by: Chris Lamb <lamby@debian.org>
---
 daklib/queue.py |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/daklib/queue.py b/daklib/queue.py
index edd14d7..bb5eb75 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
 
-- 
1.6.3.3


Reply to: