From 14b618e262caa8d5eec3da81d06c7a3c11576708 Mon Sep 17 00:00:00 2001 From: Mike O'Connor Date: Sat, 24 Jan 2009 12:38:22 -0500 Subject: [PATCH] dont send email unless there is something to categorize Signed-off-by: Mike O'Connor --- dak/bts_categorize.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dak/bts_categorize.py b/dak/bts_categorize.py index 3a3a8899..11fc18c6 100755 --- a/dak/bts_categorize.py +++ b/dak/bts_categorize.py @@ -124,14 +124,14 @@ class BugClassifier(object): return retval def email_text(self): - controls = 'user ftp.debian.org@packages.debian.org\n' + controls = "" bc = BugClassifier() for bug in bc.unclassified_bugs(): controls += bc.classify_bug(bug) - return controls - + if controls: + return 'user ftp.debian.org@packages.debian.org\n' + controls import smtplib import email.Message @@ -182,11 +182,14 @@ def main(): body = BugClassifier().email_text() - if Options["Simulate"]: - print body + if body: + if Options["Simulate"]: + print body + else: + send_email(body) else: - send_email(body) + log.info( "nothing to do" ) if __name__ == '__main__': -- 2.39.5